CameraHandle

template<IsSpectral TSpectral>
class CameraModelHandle : public huira::Handle<CameraModel<TSpectral>>

Handle for manipulating a CameraModel in a scene.

Provides a safe, reference-like interface for configuring and querying a CameraModel instance within a scene graph. All operations are forwarded to the underlying CameraModel.

Template Parameters:

TSpectral – The spectral type (e.g., float, Vec3f, etc.)

Public Functions

CameraModelHandle() = delete
void set_focal_length(units::Millimeter focal_length) const

Set the focal length of the camera (in millimeters).

Parameters:

focal_length – Focal length in millimeters

units::Millimeter focal_length() const

Get the focal length of the camera (in millimeters).

Returns:

units::Millimeter Focal length in millimeters

void set_fstop(float fstop) const

Set the f-stop (aperture ratio) of the camera.

Parameters:

fstop – F-stop value

float fstop() const

Get the f-stop (aperture ratio) of the camera.

Returns:

float F-stop value

template<IsDistortion<TSpectral> TDistortion, typename ...Args>
void set_distortion(Args&&... args) const

Set the distortion model for the camera.

Template Parameters:
  • TDistortionDistortion model type

  • Args – Constructor arguments for the distortion model

Parameters:

args – Arguments to construct the distortion model

void set_brown_conrady_distortion(BrownCoefficients coeffs) const

Set Brown-Conrady distortion coefficients.

Parameters:

coeffs – Brown distortion coefficients

void set_opencv_distortion(OpenCVCoefficients coeffs) const

Set OpenCV distortion coefficients.

Parameters:

coeffs – OpenCV distortion coefficients

void set_owen_distortion(OwenCoefficients coeffs) const

Set Owen distortion coefficients.

Parameters:

coeffs – Owen distortion coefficients

void delete_distortion() const

Delete the distortion model from the camera.

template<IsSensor<TSpectral> TSensor, typename ...Args>
void set_sensor(Args&&... args) const

Set the sensor model for the camera.

Template Parameters:
  • TSensor – Sensor model type

  • Args – Constructor arguments for the sensor

Parameters:

args – Arguments to construct the sensor

void set_sensor_resolution(Resolution resolution) const

Set the sensor resolution.

Parameters:

resolution – Sensor resolution (width, height)

void set_sensor_resolution(int width, int height) const

Set the sensor resolution by width and height.

Parameters:
  • width – Sensor width in pixels

  • height – Sensor height in pixels

void set_sensor_pixel_pitch(units::Millimeter pitch_x, units::Millimeter pitch_y) const

Set the sensor pixel pitch in x and y directions.

Parameters:
  • pitch_xPixel pitch in x (millimeters)

  • pitch_yPixel pitch in y (millimeters)

void set_sensor_pixel_pitch(units::Millimeter pitch) const

Set the sensor pixel pitch (square pixels).

Parameters:

pitchPixel pitch in both x and y (millimeters)

void set_sensor_size(units::Millimeter width, units::Millimeter height) const

Set the physical sensor size.

Parameters:
  • width – Sensor width in millimeters

  • height – Sensor height in millimeters

void set_sensor_size(units::Millimeter width) const

Set the sensor width and compute height from aspect ratio.

Parameters:

width – Sensor width in millimeters

void set_sensor_quantum_efficiency(double qe) const

Set the sensor quantum efficiency.

Parameters:

qe – Quantum efficiency value

void set_sensor_quantum_efficiency(TSpectral qe) const

Set the sensor quantum efficiency.

Parameters:

qe – Quantum efficiency value

void set_sensor_full_well_capacity(float fwc) const

Set the sensor full well capacity.

Parameters:

fwc – Full well capacity value

void set_sensor_simulate_noise(bool simulate_noise) const

Enable or disable sensor noise simulation.

Parameters:

simulate_noise – True to enable noise simulation, false to disable

void set_sensor_read_noise(float read_noise) const

Set the sensor read noise.

Parameters:

read_noise – Read noise value

void set_sensor_dark_current(float dark_current) const

Set the sensor dark current.

Parameters:

dark_current – Dark current value

void set_sensor_bias_level(float bias_level) const

Set the sensor bias level.

Parameters:

bias_level – Bias level value

void set_sensor_bit_depth(int bit_depth) const

Set the sensor bit depth.

Parameters:

bit_depth – Bit depth value

void set_sensor_gain(float gain) const

Set the sensor gain (ADU).

Parameters:

gain – Gain value

void set_sensor_gain_db(float gain_db) const

Set the sensor gain in decibels (dB).

Parameters:

gain_db – Gain in dB

void set_sensor_uinty_db(float unity_db) const

Set the sensor unity gain in decibels (dB).

Parameters:

unity_db – Unity gain in dB

void set_sensor_rotation(units::Radian angle) const

Set the sensor rotation angle.

Parameters:

angleRotation angle in radians

template<IsAperture TAperture, typename ...Args>
void set_aperture(Args&&... args) const

Set the aperture model for the camera.

Template Parameters:
  • TApertureAperture model type

  • Args – Constructor arguments for the aperture

Parameters:

args – Arguments to construct the aperture

template<IsPSF TPSF, typename ...Args>
void set_psf(Args&&... args) const

Set the point spread function (PSF) model for the camera.

Template Parameters:
  • TPSFPSF model type

  • Args – Constructor arguments for the PSF

Parameters:

args – Arguments to construct the PSF

void use_aperture_psf(bool value) const

Use the aperture to generate a PSF (point spread function).

Parameters:

value – True to enable aperture PSF, false to disable

void use_aperture_psf(int radius = 64, int banks = 16) const

Use the aperture to generate a PSF (point spread function).

Parameters:
  • radiusPSF kernel radius

  • banks – Number of PSF banks

void enable_psf_convolution(bool convolve_psf = true) const

Convolve the specified PSF with rendered extended images.

Parameters:

convolve_psf – True to enable convolving the PSF with rendered images.

void delete_psf() const

Delete the PSF and disable aperture PSF usage.

void enable_depth_of_field(bool depth_of_field = true) const

Enable or disable depth of field effects.

Parameters:

depth_of_field – True to enable depth of field, false to disable

void set_focus_distance(units::Meter focus_distance) const

Set the focus distance for depth of field calculations.

Parameters:

focus_distance – Focus distance in meters

units::Meter get_focus_distance() const

Get the current focus distance for depth of field calculations.

Returns:

units::Meter Focus distance in meters

void set_diopters(units::Diopter diopters) const

Set the diopters for depth of field calculations.

Parameters:

diopters – Diopters value

units::Diopter get_diopters() const

Get the current diopters value for depth of field calculations.

Returns:

units::Diopter Diopters value

Pixel project_point(const Vec3<float> &point_camera_coords) const

Project a 3D point in camera coordinates onto the image plane.

Parameters:

point_camera_coords – 3D point in camera coordinates (meters)

Returns:

Pixel 2D point on the image plane (pixels)

FrameBuffer<TSpectral> make_frame_buffer() const

Create a new frame buffer with the camera’s resolution.

Returns:

FrameBuffer<TSpectral> Frame buffer

void use_blender_convention(bool value = true) const

Set whether to use Blender’s camera convention (z forward, y up).

Parameters:

value – True to use Blender convention

bool valid() const

Checks if the handle points to a valid, scene-owned object.

Returns:

true if valid, false otherwise

std::shared_ptr<U> get() const

Gets a shared_ptr to the referenced object, optionally downcasting to a derived type.

Template Parameters:

U – Type to cast to (default: T)

Throws:

std::runtime_error

Returns:

std::shared_ptr

Protected Functions

std::shared_ptr<T> get_() const

Gets a shared_ptr to the referenced object, enforcing validity.

Throws:

std::runtime_error – if the handle is invalid

Returns:

std::shared_ptr<T> Shared pointer to the object

Protected Attributes

std::weak_ptr<T> ptr_

Friends

friend class Scene< TSpectral >
friend class SceneView< TSpectral >
friend class FrameHandle< TSpectral >