Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sensor size #1163

Open
TheMr33 opened this issue Nov 29, 2024 · 0 comments
Open

Update sensor size #1163

TheMr33 opened this issue Nov 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@TheMr33
Copy link

TheMr33 commented Nov 29, 2024

Describe your feature request

I have the specifications of a camera (sensor size in mm, focal distance, field of view etc…) and I would like to create a virtual camera that would mirror those parameters. However it does not seem possible to update the sensor size using the camera api. As a result, even if the field of view is correct, the parameters of the focal length no longer match the one of the original camera.

Describe a possible solution

A simple solution would be to add a function like:

def set_sensor_size(cam: bpy.types.Camera, sensor_width_in_mm: float = None, sensor_height_in_mm: float = None):
    """ Update the sensor size of the camera.

    :param cam: The camera object.
    :param sensor_width_in_mm: width of the sensor in mm.
    :param sensor_height_in_mm: height of the sensor in mm.
    """
    if sensor_width_in_mm is not None:
        cam.sensor_width = sensor_width_in_mm
    if sensor_height_in_mm is not None:
        cam.sensor_height = sensor_height_in_mm

and call this function at the beginning of set_intrinsics_from_K_matrix and set_intrinsics_from_blender_params (and maybe set_resolution?)

@TheMr33 TheMr33 added the enhancement New feature or request label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant