Questions tagged [opencv-solvepnp]

This tag is used in questions related to estimating the pose of an object. In other words, the relative orientation and position with respect to a camera

The 'PNP' in solvepnp means Perspective-n-Point.

For more details camera calibration and 3D reconstruction has a detailed explanation. And if that is not enough, Head pose estimation using OpenCV can help you further.

98 questions
3
votes
1 answer

Understanding the solvePnP Algorithm

I'm having trouble understanding the Perspective-n-Point problem. A few questions: What is s for? Why do we need a scale factor for the image point? Is K[R|T] a "change of coordinates matrix" which moves p_w, the homogenous world point, into the…
Carpetfizz
  • 8,707
  • 22
  • 85
  • 146
3
votes
1 answer

OpenCV solvePnPRansac

I'm using OpenCV 3.1 on Windows. A snippet of code: RNG rng; // random number generator cv::Mat rVec = (cv::Mat_(3, 1) << 0.08257, -0.6168, 1.4675); cv::Mat tVec = (cv::Mat_(3, 1) << -0.3806, -0.1605, 0.6087); for (int i = 0; i <…
AndroC
  • 4,758
  • 2
  • 46
  • 69
2
votes
1 answer

how do i transform camera coordinate to world coordinate use opencv

schematic diagram picture use opencv slovePNP func input world coordinate four point get R and T R = np.array([[-0.0813445156856268], [-2.5478950926311636], [1.7376856594745234]], dtype=np.float32) T = np.array([[10.838262901867047],…
guogene
  • 61
  • 1
  • 4
2
votes
0 answers

C++ OpenCV 4.4.0 solvePnP error: (-215:Assertion failed)

I am trying to write a simple augmented reality program that, given and output video and the camera intrinsic parameters, projects 3 lines into each video frame. These lines are the x,y and z axis. I'm asking for help not for the program itself but…
kerkeplank
  • 33
  • 2
2
votes
1 answer

Where I can find opencv.js with solvePnP or how to build it?

Hello guys) I need function solvePnP from opencv in opencv.js. But I can't find version with solvepnp included. Could you, please, help me to find opencv.js version with solvePnP or build it? Do you know where I can find solvePnP in other js…
2
votes
0 answers

Building OpenCV.js with wrappers for projectPoints + solvePnP

Porting to JavaScript: "Cannot register public name 'projectPoints' twice" I did the following: git clone https://github.com/opencv/opencv.git git clone https://github.com/opencv/opencv_contrib.git I added the following in def get_build_flags(self)…
KaviKrish
  • 21
  • 1
  • 3
2
votes
0 answers

Pose Estimation - cv::SolvePnP with Scenekit - Coordinate System Question

I have been working on Pose Estimation (rectifying key points on a 3D model with 2D points on an image to match pose) via OpenCV's cv::solvePNP, using features / key points from Apples Vision framework. TL-DR: My scene kit model is being translated…
vade
  • 702
  • 4
  • 22
2
votes
0 answers

solvePnP results differ too much from expected results (Python, OpenCV)

I have a car with a camera, an imu and a gps on top of it. The camera takes pictures while driving around. The pictures and the gps coordinates are synchronized. Now, I am trying to get the camera pose from the pictures (relative to the imu), but…
2
votes
0 answers

Camera position in world coordinate is not working but object pose in camera co ordinate system is working properly

I am working on the camera (iphone camera) pose estimation for head mount device (Hololens) using LEDs as a marker, using the solvepnp. I have calibrated the camera below is the camera intrinsic parameters /* approx model*/ double focal_length =…
2
votes
1 answer

Where is the returning values of cv2.solvePnP actually holding the camera's position?

There's a cube and a camera in the real world. Each point coordinates are shown in the following figure. It is clear that the camera's coordinate is at [0,0,1]. We can calculate each position's displayed coordinates on screen. import numpy as…
2
votes
0 answers

OpenCV to WebGL

I'm trying to use OpenCV with WebGL. In OpenCV, I'm looking for a projection (a priori the projection matrix of the camera) that I get using SolvePnp. When I display the projection obtained in OpenCV with the 'projectPoints' function, everything is…
kopacabana
  • 437
  • 3
  • 17
1
vote
0 answers

solvePnP method estimation distance error

I am dealing with the estimated distance of an object with the solvePnP method. I already did some measurements and my calculated distance is far above the actual distance. I also used a calibrated camera. For the distance calculation, I use the…
PaaaV
  • 11
  • 1
1
vote
0 answers

Calculation of world coordinates of camera from chessboard image

I have a stationary camera and want to get the real world coordinates and rotation from my camera (relative to the pattern). I placed a checkerboard pattern in the FoV of the camera and took some images. Some might say, this question already has an…
Sheradil
  • 407
  • 3
  • 14
1
vote
1 answer

Object Pose solvePnP

Unable to get object Pose and draw axis with 4 markers I am trying to get the object pose by following This tutorial for Pose Estimation. In the video the author uses chessboard pattern(24,17) and mentions in the comment that any object with…
AqibF
  • 13
  • 4
1
vote
1 answer

solvePnP throws error: (-215:Assertion failed) src.size == dst.size && src.channels() == dst.channels() in function 'cvConvertScale'

I have 4 world coordinate points of a box and their image points . I'm trying to calculate the pose of the camera but I'm getting an error File c:\Users\nmorsi200\AppData\Local\Temp\Prog6_4.py", line 292, in