FUNCTION REFERENCE
worldToImage
Project world points into the image of a camera.
Project world points into the image of a camera.
Syntax
imagePoints = worldToImage(intrinsics, rotationMatrix, translationVector, worldPoints)Syntax
[imagePoints, validIndex] = worldToImage(___, 'ApplyDistortion', tf)intrinsics is a cameraIntrinsics or cameraParameters object; rotationMatrix is 3-by-3 and translationVector 1-by-3 in the postmultiply convention: camera coordinates [Xc Yc Zc] = [X Y Z] * R + t. worldPoints is M-by-3, or M-by-2 for points on the plane z = 0. imagePoints (M-by-2 [x y]) is [fx*x + s*y + cx, fy*y + cy] with x = Xc/Zc, y = Yc/Zc. With 'ApplyDistortion' true (default false) x and y first get radial (k1..k3) and tangential (p1, p2) distortion: r2 = x^2 + y^2, xd = x(1 + k1 r2 + k2 r2^2 + k3 r2^3) + 2 p1 x y + p2 (r2 + 2 x^2), yd = y(1 + ...) + p1 (r2 + 2 y^2) + 2 p2 x y. validIndex is true for points in front of the camera (Zc > 0) that land inside the image ([0.5, ncols+0.5] by [0.5, nrows+0.5]).
Example
c = cameraIntrinsics([800 800], [320 240], [480 640]); worldToImage(c, eye(3), [0 0 10], [1 2 0]) % [400 400]Example
c = cameraIntrinsics([800 800], [320 240], [480 640]); [p, ok] = worldToImage(c, eye(3), [0 0 -10], [1 2 0]); ok % false (behind the camera)Differences from MATLAB: the rigidtform3d form worldToImage(intrinsics, tform, worldPoints) and fisheye cameras are not supported yet; the validIndex image bounds are MatRust's reading of the reference page.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.