Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Correct K, tvec and rvec for ProjectPoints

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

When setting K to identity, rvec=tvec=(0,0,0) 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

Correct K, tvec and rvec for ProjectPoints

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

Correct K, tvec and rvec for ProjectPoints

C:\fakepath\model.pngOpenCV 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

Correct K, tvec and rvec for ProjectPoints

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