3
$\begingroup$

I have rendered an image of size 150*120,
I think the amount of pixel size is related to the sensor size, isn't it?
But I have the sensor size just for the horizontal direction which is 32.
How can I calculate the pixel size for each direction of my rendered image?
Thanks.

$\endgroup$
  • $\begingroup$ What do you mean by "pixel size"? Not the image resolution, which you specified. Do you mean the size of 1 pixel? (Probably related to pixel density, PPI / DPI, which is probably 72) $\endgroup$ – TLousky Sep 7 '15 at 20:49
  • $\begingroup$ Sensor size and render size are two different and independent controls. Making your sensor larger will not affect how large the image is. Can you please edit your question and elaborate on what you are trying to accomplish? $\endgroup$ – cegaton Sep 7 '15 at 22:08
2
$\begingroup$

Here is an illustrative code fragment to show how to compute the pixel sizes in each direction (u is horizontal, v is vertical):

scale = scene.render.resolution_percentage / 100
pixels_in_u_per_mm = resolution_x_in_px * scale / sensor_width_in_mm
pixels_in_v_per_mm = resolution_y_in_px * scale * aspect_ratio / sensor_height_in_mm
pixel_size_in_u_direction = 1/pixels_in_u_per_mm
pixel_size_in_v_direction = 1/pixels_in_v_per_mm

By experimenting with blender, I found out that by default (camera sensor fit set to "auto") the sensor width is fixed, the sensor height is effectively changed with the aspect ratio settings.

The current Blender GUI only specifies the sensor width by default, but there is a variable for sensor height in the internal camera data. It is used if the camera's sensor fit is set to something other than "Auto", which I don't currently cover in this answer (see next paragraph for another answer where I cover these).

The above code is based on the Python code in my answer to What is blender's camera projection matrix model?. You can find details on how to get the relevant parameters there, and also how to deal with other sensor fit settings.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.