gradoptics.optics.camera

class gradoptics.optics.camera.Camera(lens, sensor, intermediate_objects=[])

Bases: gradoptics.optics.base_optics.BaseOptics

Models a camera by compounding multiple optical elements.

__init__(lens, sensor, intermediate_objects=[])
Parameters
  • lens – External lens - interface with the world (Lens)

  • sensor – Sensor (Sensor)

  • intermediate_objects – list of optical elements between the external lens and the sensor (list of BaseOptics)

get_ray_intersection(incident_rays)

Computes the times t at which the incident rays will intersect the object.

Parameters

incident_rays – The incident rays (Rays)

Returns

Times t (torch.tensor)

intersect(incident_rays, t)

Returns the rays reflected or refracted by the optical element.

Parameters
  • incident_rays – The incident rays (Rays)

  • t – The times at which the incident rays will intersect the optical element (torch.tensor)

Returns

(tuple) - Reflected or refracted rays (Rays) - A boolean mask that indicates which incident rays were reflected or refracted ― some rays may not be

reflected or refracted for example, due to total internal reflection, which is not modelled at this point (torch.tensor)

plot(ax)

Plots the optical element on the provided axes.

Parameters

ax – 3d axes (mpl_toolkits.mplot3d.axes3d.Axes3D)