How do I use the 'worldToImage' function?

3 次查看(过去 30 天)
I am trying to use the function "worldToImage" to superimpose a 3D point cloud representation of an object onto a 2D image. At the outset, I am not 100% sure this is the right function to do this. If there is a better way, then please let me know.
When I run the "worldToImage" function I get an error that says "Undefined function 'worldToImage' for input arguments of type 'double'." I'm not sure I understand what this error means or how to resolve it.
Below is a portion of my test code:
worldPoints = [x, y, z];
R = [1, 1, 1; 1, 1, 1; 1, 1, 1];
t = [0, 0, 0];
projectedPoints = worldToImage(camMatrix,R,t,worldPoints);
In my test code I am simply trying to see how the 3D points are projected onto the 2D image. My worldPoints are my point cloud points which is an Mx3 matrix in 'double'. I'm assuming that this is the problem, but I am not sure how else to input these points to make this function work. Does anyone have any insight?
I've already confirmed that this is not a license or path issue for this function.

回答(1 个)

Amal George M
Amal George M 2018-8-29
To my understanding, the intention is to use 'worldToImage' function to project world coordinates onto a 2D Image. Can you check the datatype of the 'camMatrix' variable?
From the documentation, the first argument to ' worldToImage() ' is a 'cameraParameters' object, not a simple matrix.
Also, 'rotationMatrix' corresponding to no rotation is the Identity matrix.

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for USB Webcams 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by