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
33
votes
2 answers

Can you use OpenCV solvePNP with a equirectangular image?

Is it possible to use OpenCV's solvePNP with an equirectangular image? I have an equirectangular image and I have four points in this image (red dots) and their pixel coordinates, and then I have 4 corresponding world points e.g. [(0, 0, 0), (2, 0,…
nickponline
  • 25,354
  • 32
  • 99
  • 167
25
votes
3 answers

Camera pose from solvePnP

Goal I need to retrieve the position and attitude angles of a camera (using OpenCV / Python). Definitions Attitude angles are defined by: Yaw being the general orientation of the camera when it lays on an horizontal plane: toward north=0, toward…
swiss_knight
  • 5,787
  • 8
  • 50
  • 92
14
votes
1 answer

Why Direct Linear Transformation (DLT) cannot give the optimal camera extrinsics?

I'm reading the source code of function solvePnP() in OpenCV, when the flags param uses default value SOLVEPNP_ITERATIVE, it's calling cvFindExtrinsicCameraParams2, in which it FIRST uses the DLT algorithm (if we have a non-planar set of 3D points)…
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
12
votes
1 answer

solvePNP vs recoverPose by rotation composition: why translations are not same?

Part 1: Before update I am trying to estimate relative position using two different methods: solvePNP and recoverPose, and seems like R matrices are looks OK with respect to some error, but translation vectors are totally different. What am I…
7
votes
0 answers

OpenCV Python solvePnP's EPnP implementation not producing the same output as official MATLAB EPnP implementation

these days I am working on understanding the solvePnP algorithm used for computer vision. I found the official EPnP algorithm in MATLAB here https://github.com/cvlab-epfl/EPnP. I am comparing the results of the official implementation with the…
rassi
  • 375
  • 3
  • 8
6
votes
0 answers

Mismatch between OpenCV projected points and Unity camera view

We are working on an AR application in which we need to overlay a 3D model of an object on a video stream of the object. A Unity scene contains the 3D model and a camera is filming the 3D object. The camera pose is initially unknown. ▶ What we have…
5
votes
0 answers

How to understand Euler angles from cv2.decomposeProjectionMatrix?

I have been searching the internet for hours on some documentation on how to understand the Euler angles returned by cv2.decomposeProjectionMatrix. My problem seems simple, I have this 2D image of an aircraft. I want to be able to derive from that…
Chris Unice
  • 181
  • 2
  • 8
4
votes
1 answer

rvec/tvec from solvePnP vs. rvec/tvec from calibrateCamera

I've read this answer but I still don't understand the rvec/tvec pair returned by calibrateCamera and the rvec/tvec pair returned by solvePnP. I understand that solvePnP solves for [R|T] which is given here. This is very clear - it's an affine…
Carpetfizz
  • 8,707
  • 22
  • 85
  • 146
4
votes
1 answer

OpenCV Error: Assertion failed in undistort.cpp at line 293

Found solution at https://github.com/opencv/opencv/issues/4943 OpenCV Error: Assertion failed (CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1…
djkpA
  • 1,224
  • 2
  • 27
  • 57
4
votes
1 answer

OpenCV : SolvePnP is giving different results for same input parameters

I am trying to estimate the 3D Pose of an object using solvePnP in python. But the problem is even if I kept both the camera and object static, the output of solvePnP (rvec and tvec) are changing. The world coordinates system is centered on the…
djkpA
  • 1,224
  • 2
  • 27
  • 57
4
votes
1 answer

Find rectangular object quality with perspective

I get image from a camera (calibrated and without lens distortions) and I need to detect a rectangular object. Markers are a good example. For markers I check corner count, min size, board contrast and convexity. I had an idea on how to improve this…
user1214513
  • 273
  • 2
  • 5
  • 10
3
votes
1 answer

Want to find rotation and position in perspective world of plane from 2d points in image

I have 2D png image I want to place a 3D plane at a perfect rotation and position of the sofa as shown in figure I am using three.js and a perspective camera to manually add the rotation and translation to the plane. I have the center and corner…
3
votes
1 answer

What does the error fabs(sc) > DBL_EPSILON mean in function cvFindExtrinsicCameraParams2?

I am using the solvePnPRansac function from OpenCV (4.0.0) in python. Sometimes (but not all the time) when I pass points into the function I get an error: (-215:Assertion failed) fabs(sc) > DBL_EPSILON in function `cvFindExtrinsicCameraParams2'…
crock
  • 53
  • 8
3
votes
1 answer

How can I solvePnP with fisheye camera parameters?

I saw that OpenCV's solvePnP() function assume that your camera parameters are from a pinhole model. But I calibrated my camera using cv.fisheye module, so I wanted to know how to use solvePnP with parameters obtained from that fisheye module. How…
off99555
  • 3,797
  • 3
  • 37
  • 49
3
votes
1 answer

camera pose estimation with solvePnP() and SOLVEPNP_IPPE_SQUARE method

I'm working with ARKit and trying to get camera position from QR code with known size (0.16m). To detect QR code I'am using Vision framework so i can get each corner point on image. Data preparation: let intrinsics = arFrame.camera.intrinsics let…
Dim Roe
  • 43
  • 1
  • 3
1
2 3 4 5 6 7