Placement
class optris_sdk.canvas.Placement
Where one camera's frame sits in view space.
A 3x3 affine transform: zoom, rotation, and where the frame's
centre lands. Construct with identity or centred
rather than directly -- the underlying struct is versioned and
carries its own size, so it has to be initialised through the ABI.
Placement — properties
matrix
The nine coefficients of the transform, row by row.
zoom
Output pixels per camera pixel.
rotation_deg
Rotation in degrees, anticlockwise.
has_shear
Whether the transform shears.
A placement built by this module never does; one read back out of a canvas somebody else composed may.
is_identity
Whether this placement moves nothing.
Placement — methods
identity(cls)
A placement that moves nothing.
centred(cls, frame_width, frame_height, at = (0.0, 0.0), zoom = 1.0, rotation_deg = 0.0)
A frame centred on at, zoomed and rotated about itself.
- Parameter
frame_width— the camera's width in pixels. - Parameter
frame_height— the camera's height in pixels. - Parameter
at— where the frame's centre lands, as(x, y). - Parameter
zoom— 1.0 is one output pixel per camera pixel. - Parameter
rotation_deg— degrees, anticlockwise.
frame_centre(frame_width, frame_height)
Where this frame's centre lands, as (x, y).
inverse()
The inverse transform's nine coefficients, or None.
None when the transform cannot be inverted -- a zero zoom,
or a degenerate matrix read back from somewhere else. The ABI
reports that through a flag beside the matrix, and this returns
None rather than nine numbers nobody should use.
set_zoom(zoom, frame_width, frame_height)
Set the zoom, keeping the frame's centre where it is.
set_rotation_deg(degrees, frame_width, frame_height)
Set the rotation, keeping the frame's centre where it is.
set_frame_centre(at, frame_width, frame_height)
Move the frame's centre to at, as (x, y).
pan(delta)
Shift the frame by delta, as (dx, dy).
Needs no frame size: a pan is a translation in view space and does not depend on how big the camera's picture is.