cpp-tutorial-pnp_registration throw error [closed]
Hi everyone,
I am trying to use cpp-tutorial-pnp_registration in opencv sample code whose location is /home/*/opencv-3.2.0/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp
I just try to use opencv original data resized_IMG_3875.JPG and box.ply to get textured 3D model (yml file), however, opencv throw the following error for me:
--------------------------------------------------------------------------
This program shows how to create your 3D textured model.
Usage:
./cpp-tutorial-pnp_registration
--------------------------------------------------------------------------
init done
Click the box corners ...
Waiting ...
COMPUTING POSE ...
OpenCV Error: Assertion failed (npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F))) in solvePnP, file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/calib3d/src/solvepnp.cpp, line 63
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/calib3d/src/solvepnp.cpp:63: error: (-215) npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function solvePnP
Aborted (core dumped)
I am not sure what the problem is and could you give me some idea? Any idea will be appreciate.
Thanks in advance.
No problem for me. You have to clic at least 4 points to use this program
Thanks for your quick reply. after I run ./cpp-tutorial-pnp_registration, the window is closed quickly and I don't have time to clic in the window.
i check the picture in the window, it is black and does not show the box figure.
How do you run ? click or open terminal ? do you use windows or linux?
I use ubuntu 16.04 and I can attach my screen shot of my pc.
I use windows and I'm not a linux specialist. Have you seen this image ? If no program try to load this image from this folder : "../../samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/" ?
if you arrive at "COMPUTING POSE ...", you're already behind the "wait for clicks" loop.
maybe it's just paranoid, but it might suffer from the "waitkey does not return -1" bug (which was around in early 3.2.0).
could you try to change this line to
(and then, break out if the loop by pressing the escape key)
well, if that should fix it, you still want to update to latest github master branch, i guess...
Yes, it fixed. Thanks! i will update it.
again, that was a shortlived bug, which was fixed in the meantime, so please update your opencv libs.