oursin.camera
Camera
Functions
Handler for receiving data about incoming images |
|
Handler for receiving metadata about incoming images |
|
Change the camera that the main light is linked to (the light will rotate the camera) |
|
Override the rotation of the main camera light |
Classes
- on_camera_img_meta(data_str)[source]
Handler for receiving metadata about incoming images
Parameters
- data_strstring
JSON with two fields {“name”:””, “totalBytes”:””}
- on_camera_img(data_str)[source]
Handler for receiving data about incoming images
Parameters
- data_strstring
JSON with two fields {“name”:””, “bytes”:””}
- class Camera(main=False)[source]
Bases:
object
- delete()[source]
Deletes camera
Parameters
references object being deleted
Examples >>>c1.delete()
- set_target_coordinate(camera_target_coordinate)[source]
Set the camera target coordinate in CCF space in um relative to CCF (0,0,0), without moving the camera. Coordinates can be negative or larger than the CCF space (11400,13200,8000)
Parameters
- camera_target_coordinatefloat list
list of coordinates in ap, ml, dv in um
Examples
>>>c1.set_target_coordinate([500,1500,1000])
- set_rotation(rotation)[source]
Set the camera rotation (pitch, yaw, roll). The camera is locked to a target, so this rotation rotates around the target.
Rotations are applied in order: roll, yaw, pitch. This can cause gimbal lock.
Parameters
- rotationfloat list OR string
list of euler angles to set the camera rotation in (pitch, yaw, roll) OR string: “axial”, “coronal”, “sagittal”, or “angled”
Examples
>>> c1.set_rotation([0,0,0]) >>> c1.set_rotation("angled")
- set_zoom(zoom)[source]
Set the camera zoom.
Parameters
- zoomfloat
camera zoom parameter
Examples
>>> c1.set_zoom(1.0)
- set_target_area(camera_target_area)[source]
Set the camera rotation to look towards a target area
Note: some long/curved areas have mesh centers that aren’t the ‘logical’ center. For these areas, calculate a center yourself and use set_camera_target.
Parameters
- camera_target_areastring
area ID or acronym, append “-lh” or “-rh” for one-sided meshes
Examples
>>> c1.set_target_area("grey-l")
- set_pan(pan_x, pan_y)[source]
Set camera pan coordinates
Parameters
- pan_xfloat
x coordinate
- pan_yfloat
y coordinate
Examples
>>> c1.set_pan(3.0, 4.0)
- set_mode(mode)[source]
Set camera perspective mode
Parameters
- modestring
“perspective” or “orthographic” (default)
Examples
>>> c1.set_mode('perspective')
- set_background_color(background_color)[source]
Set camera background color
Parameters
background_color : hex color string
Examples
>>> c1.set_background_color('#000000') # black background
- async screenshot(size=[1024, 768], filename='return')[source]
Capture a screenshot, must be awaited
Parameters
- sizelist, optional
Size of the screenshot, by default [1024,768]
- filename: string, optional
Filename to save to, relative to local path
Examples
>>> await urchin.camera.main.screenshot()
- async capture_video(file_name, start_rotation, end_rotation, frame_rate=30, duration=5, size=(1024, 768))[source]
Capture a video and save it to a file, must be awaited
Warning: start and stop rotations are currently implemented in Euler angles any rotation that uses multiple axes will not look correct! This will be updated in a future release.
Parameters
- file_namestring
File to save to, relative to local path
- start_rotationvector3
(yaw, pitch, roll) of camera at the start
- end_rotationvector3
(yaw, pitch, roll) of camera at the start
- frame_rateint, optional
by default 30
- sizelist, optional
width/height, by default [1024,768]
Examples
>>> await urchin.camera.main.capture_video('output.mp4', start_rotation=[22.5, 22.5, 225], end_rotation=[22.5, 22.5, 0])