Correct K, tvec and rvec for ProjectPoints

asked 2014-06-14 09:43:52 -0600

MRDaniel gravatar image

updated 2014-06-14 09:49:57 -0600

C:\fakepath\model.png

Above is a link to the output when using default/blank values.

OpenCV Project points.

Issue one. I cannot seem to get tvec as a 1x3 matrix after using decomposeprojectionmatrix(). How is this done? ProjectPoints expects a 1x3 translation vector.

Issue two. When setting K to identity, rvec=tvec=(0,0,0) (as suggested in documentation for partial modelling) i get a result that is at the origin. Is there some sort of scaling required here?

We create 8 points to represent the corners of a cube and then project those points and draw them. P is taken from this sample.

https://github.com/daviddoria/Examples/blob/master/c%2B%2B/OpenCV/ProjectPoints/ProjectPoints.cxx

This suggests using cv::convertPointsHomogeneous(Thomogeneous, T); however opencv is expecting an array of points, not a 3 column vector.

My code is here.

http://pastebin.com/VGhGmj7W

edit retag flag offensive close merge delete