real time pose etimation Unspecified error

asked 2019-11-04 22:20:51 -0600

fabianc20 gravatar image

Dear Opencv'rs

I am running the "model registration" program of the real_time_pose_etimation sample.

Opencv 4.1.1

Windows 10 Pro, X64

VS 2019, ver 16.3.5

Code: C:\opencv\sources\samples\cpp\tutorial_code\calib3d\real_time_pose_estimation\src

Reproduce the situation:

Add all .h and .cpp files in src folder to a new project (Not main_registration.cpp. FYI main_detection.cpp and main_registration.cpp are two exclude ways to tackle pose estimation). Copy the data folder to project forlder.

Disabled -if you get those- all the compiling warning messages. (Project Properties --> Configuration Properties --> C++ --> Advance --> Disable Specific Warnings: 26451;26812;26495;6294;6201;26439;26812)

Build and Run with the default parser values. No changes to code what so ever. We just need to see it working.

If you get what I do, runtime goes fine when

  1. The application loads the 3D textured model in YAML file format

  2. From the scene -recorded video-, the ORB features and descriptors are detected and extracted.

  3. cv::FlannBasedMatcher & cv::flann::GenericIndex match model-scene descriptors.

But it fails, I beleive, at:

  1. Using these matches and cv::solvePnPRansac the R and t of the camera are computed. I GET THIS:

OpenCV(4.1.1) Error: Unspecified error (> DLT algorithm needs at least 6 points for pose estimation from 3D-2D point correspondences. (expected: 'count >= 6'), where

'count' is 5

must be greater than or equal to '6' is 6 ) in void __cdecl cvFindExtrinsicCameraParams2(const struct CvMat *,const struct CvMat *,const struct CvMat *,const struct CvMat *,struct CvMat *,struct CvMat *,int), file C:\build\master_winpack-build-win64-vc15\opencv\modules\calib3d\src\calibration.cpp, line 1171

What should happen last:

  1. A KalmanFilter is applied in order to reject bad poses.

  2. The 6th step is set the estimated rotation-translation matrix and draw the found pose.

Thanks for taking the time and share your feedback.


edit retag flag offensive close merge delete


This error message says that the method needs at least 6 points to work. You have too few matched keypoints.

Have a look here for the videos for the tutorial.

Don't expect great result with this method. And I am not convinced by the Kalman filter formulation used. Indeed, a linear Kalman filter on Euler angles is used for rotation while an EKF or something more elaborate to filter rotation on SO3 should be used in my opinion.

Eduardo gravatar imageEduardo ( 2019-11-05 17:42:08 -0600 )edit