marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy

Home Page:https://vedo.embl.es

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set a camera with given intrinsic and extrinsic parameters

InFistLee opened this issue · comments

Hi marco. I have some questions about how to set a camera with given intrinsic and extrinsic matrix. Here intrinsic matrix is a 3X3 matrix with fx,fy,cx,cy, and extrinsic matrix is a 4X4 camera2world matrix which can be easily translated into a rotation and translation.

I have multiple cameras' poses and a mesh in a scene. Here are the camera frustum that I visualized (forgive that I can only show the pointclouds but not the actual mesh here):
image

Questions are:

  1. How can I set a camera based on given camera pose (intr and cam2world) and get the corresponding screenshot? I found something like vedo.utils.oriented_camera and vedo.utils.camera_from_dict but I am not sure how to set my camera pose into proper parameters.
  2. I have many cameras so is there a way that I can get the render results from all cameras simultaneously and plot them in the plotter? (something like virtual cameras)

Hi, yes you need to build a camera object from method camera_from_dict() and then pass it to the plotter:

plotter = Plotter(N=2, sharecam=False)

plotter.at(0).camera = camera_from_dict(...)

plotter.show(resetcam=False)