When I try to render a cube it appears too big compared to an image taken with a real camera and to the opencv method projectPoints.

My setup

I have a box and film it with a camera. A motion tracking system gives me both the position of the camera and the box. Now I can use the positional information, the size and the intrinsic camera parameters K to project the corners into the image. In blender I set the box size and pose. I also set the camera pose and K which is and my image resolution is 640x480: $$ \left(\begin{matrix} 610.55992534 & 0 & 306.86169342 \\ 0 & 610.32086262 & 240.94547232 \\ 0 & 0 & 1 \\ \end{matrix}\right) $$ and I set it like this:

cam.shift_x = (306.86169342 - 640 / 2) / 640
cam.shift_y = (240.94547232 - 480 / 2) / 640
cam.sensor_width = 3.896
cam.lens = 610.55992534 / 640 * cam.sensor_width

enter image description here The blue points are the points received with the opencv method projectPoints which takes the points to project, pose, K and projects the points into the image plane. The grey box is the one rendered with blender.

Since the blue points are pretty much correct(the residual error is probably calibration error) I think my measured poses of the box and camera and K are right. My K is:

I entered the values for the first image into blender to visually confirm that the setup looks right and it does: enter image description here But the picture rendered with the GUI looks exactly the same like the one rendered by my code.

Where could the error be that my cube is rendered too big? Did I forget to set some important camera parameter? What more could there be than setting K, and box_pose and camera_pose?


1 Answer 1


I just realized my error. I was setting the scale of my cube instead of the dimensions and since the default dimension is 2m^3 the cube was double the size it should have been.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .