c++ - Calculate Camera space coordinates from vtk render -


i have rendered image in vtk, project image points (x,y) 3d camera frame coordinates. each pixel (x,y) have z value in camera frame (obtained z-buffer).

under pinhole projection, standard way be:

x_camera_frame = (x_pixel - cx) * z_camera_frame/ fx;  y_camera_frame = (y_pixel - cy) * z_camera_frame / fy; 

where fx , fy focal length , cx cy centre of projection of camera (intrinsic parameters).

the problem is, vtkcamera can set field of view there not way set or focal length or center of projection, how go calculating x_camera_frame , y_camera_frame?

normally center of projection camera position ie. (0,0,0) in camera space. means top left corner of image should @ p = (-imagewidth/2, -imageheight/2, fl), (fl focal length) assuming no further 2d transforms (croping, resizing etc) applied after perspective transform.

p here represents point in image plane seen camera space. convert multiply inverse of projection matrix , should able point in camera space.

i assume know image width , height are. focal length, distance between camera , focal point can used. api returns projection transform matrix, can calculate inverse, before applying image plane point.

arun


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -