chili-epfl / chilitags

Robust Fiducial Markers for Augmented Reality And Robotics
http://chili.epfl.ch/software
123 stars 57 forks source link

Some little fix for opencv 3.0 #60

Closed bhack closed 9 years ago

bhack commented 9 years ago

I've made some little fix for opencv 3.0. We could wrap this for let be still compatibile with 2.4.x series?

severin-lemaignan commented 9 years ago

@bhack Thanks for your PR. Since OpenCV3 changed quite a lot over the last few months, our support for it needs indeed some update.

Can you please fence the opencv3 changes inside the #ifdef OPENCV3 macro? (see for instance here)

bhack commented 9 years ago

OK.. What kind of new available PNP solvers do you want to set by default?

ayberkozgur commented 9 years ago

Just a bit of heads up here: passage from cv::ITERATIVE to cv::SOLVEPNP_ITERATIVE (and friends) is not specifically OpenCV 3 but an intermediary API change. In other words, you won't find cv::SOLVEPNP_* in for example the 3.0.0-alpha1 tag.

Edit: By intermediary I don't mean temporary, but it's very new that's not in a tag yet.

severin-lemaignan commented 9 years ago

EPNP is not new (it is also available in opencv 2.4) and in my experience, it was not significantly better than ITERATIVE. To confirm possible (accuracy and/or speed) gains, we first need adequate benchmarks, which are not very easy to design for 3D reconstruction (because the ground truth is difficult to measure -- we probably should do it via CGI-generated images).

So, to summarize, I would keep ITERATIVE for now, and once we have benchmarks, test the other options. Or have you good evidence EPNP is indeed better?

bhack commented 9 years ago

[This](http://docs.opencv.org/trunk/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=solvepnp#bool solvePnP%28InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess, int flags%29) is the full list of solvers in master now.

qbonnard commented 9 years ago

Regarding the 3d reconstruction benchmark, how about measuring the reprojection error on a known tag configuration, like they do in the camera calibration ?

severin-lemaignan commented 9 years ago

@bhack UPNP could be interesting since it also estimate the camera focal length: no need for camera calibration anymore (in most cases)!

@qbonnard Sounds like a good idea, indeed!

bhack commented 9 years ago

@qbonnard I think that you can find something similar in opencv/test of the calibration module.

qbonnard commented 9 years ago

I think that's where I found it yes. Actually, I started a chilitags-based calibration tool, but didn't finish it up yet. It was based on the chessboard/dots calibration sample by OpenCV, and includes a reprojection measurement... Pretty easy to do actually. I just need to finish up ;)

qbonnard commented 9 years ago

Hey @bhack ! Thanks again for your PR and sorry about the delay. I've amended your commit with the fences Séverin was talking about, the cv::ITERATIVE PnP parameter, at least until we can evaluate its effect more seriously. I pushed your amended commit on my fork's master branch https://github.com/qbonnard/chilitags Would you like to try it and tell me if I can merge it to the official repository ? Quentin

bhack commented 9 years ago

Sorry I haven't time to wrap myself and commit. Seems fine to me now.

ayberkozgur commented 9 years ago

This seems to be merged, closing.