M-File Help: Camera | View code for Camera |
Camera superclass
An abstract superclass for Toolbox camera classes.
plot | plot projection of world point to image plane |
hold | control figure hold for image plane window |
ishold | test figure hold for image plane |
clf | clear image plane |
figure | figure holding the image plane |
mesh | draw shape represented as a mesh |
point | draw homogeneous points on image plane |
line | draw homogeneous lines on image plane |
plot_camera | draw camera in world view |
rpy | set camera attitude |
move | clone Camera after motion |
centre | get world coordinate of camera centre |
delete | object destructor |
char | convert camera parameters to string |
display | display camera parameters |
npix | image dimensions (2x1) |
pp | principal point (2x1) |
rho | pixel dimensions (2x1) in metres |
T | camera pose as homogeneous transformation |
nu | number of pixels in u-direction |
nv | number of pixels in v-direction |
u0 | principal point u-coordinate |
v0 | principal point v-coordinate |
Create camera object
Constructor for abstact Camera class, used by all subclasses.
C = Camera(options) creates a default (abstract) camera with null parameters.
'name', N | Name of camera |
'image', IM | Load image IM to image plane |
'resolution', N | Image plane resolution: NxN or N=[W H] |
'sensor', S | Image sensor size in metres (2x1) [metres] |
'centre', P | Principal point (2x1) |
'pixel', S | Pixel size: SxS or S=[W H] |
'noise', SIGMA | Standard deviation of additive Gaussian noise added to returned image projections |
'pose', T | Pose of the camera as a homogeneous transformation |
'color', C | Color of image plane background (default [1 1 0.8]) |
CentralCamera, fisheyecamera, CatadioptricCamera, SphericalCamera
Get camera position
p = C.centre() is the 3-dimensional position of the camera centre (3x1).
Convert to string
s = C.char() is a compact string representation of the camera parameters.
Clear the image plane
C.clf() removes all graphics from the camera's image plane.
Camera object destructor
C.delete() destroys all figures associated with the Camera object and removes the object.
Display value
C.display() displays a compact human-readable representation of the camera parameters.
Return figure handle
H = C.figure() is the handle of the figure that contains the camera's image plane graphics.
Control hold on image plane graphics
C.hold() sets "hold on" for the camera's image plane.
C.hold(H) hold mode is set on if H is true (or > 0), and off if H is false (or 0).
Plot homogeneous lines on image plane
C.line(L) plots lines on the camera image plane which are defined by columns of L (3xN) considered as lines in homogeneous form: a.u + b.v + c = 0.
Return image plane hold status
H = C.ishold() returns true (1) if the camera's image plane is in hold mode, otherwise false (0).
handle for this camera image plane
Plot mesh object on image plane
C.mesh(x, y, z, options) projects a 3D shape defined by the matrices x, y, z to the image plane and plots them. The matrices x, y, z are of the same size and the corresponding elements of the matrices define 3D points.
'Tobj', T | Transform all points by the homogeneous transformation T before projecting them to the camera image plane. |
'Tcam', T | Set the camera pose to the homogeneous transformation T before projecting points to the camera image plane. Temporarily overrides the current camera pose C.T. |
Additional arguments are passed to plot as line style parameters.
mesh, cylinder, sphere, mkcube, Camera.plot, Camera.hold, Camera.clf
Instantiate displaced camera
C2 = C.move(T) is a new camera object that is a clone of C but its pose is displaced by the homogeneous transformation T with respect to the current pose of C.
Plot points on image plane
C.plot(p, options) projects world points p (3xN) to the image plane and plots them. If p is 2xN the points are assumed to be image plane coordinates and are plotted directly.
uv = C.plot(p) as above but returns the image plane coordinates uv (2xN).
C.plot(L, options) projects the world lines represented by the array of Plucker objects (1xN) to the image plane and plots them.
li = C.plot(L, options) as above but returns an array (3xN) of image plane lines in homogeneous form.
'Tobj', T | Transform all points by the homogeneous transformation T before projecting them to the camera image plane. |
'Tcam', T | Set the camera pose to the homogeneous transformation T before projecting points to the camera image plane. Overrides the current camera pose C.T. |
'fps', N | Number of frames per second for point sequence display |
'sequence' | Annotate the points with their index |
'textcolor', C | Text color for annotation (default black) |
'textsize', S | Text size for annotation (default 12) |
'drawnow' | Execute MATLAB drawnow function |
Additional options are considered MATLAB linestyle parameters and are passed directly to plot.
Camera.mesh, Camera.hold, Camera.clf, plucker
Display camera icon in world view
C.plot_camera(options) draw a camera as a simple 3D model in the current figure.
'Tcam', T | Camera displayed in pose T (homogeneous transformation 4x4) |
'scale', S | Overall scale factor (default 0.2 x maximum axis dimension) |
'color', C | Camera body color (default blue) |
'frustrum' | Draw the camera as a frustrum (pyramid mesh) |
'solid' | Draw a non-frustrum camera as a solid (default) |
'mesh' | Draw a non-frustrum camera as a mesh |
'label' | Show the camera's name next to the camera |
Plot homogeneous points on image plane
C.point(p) plots points on the camera image plane which are defined by columns of p (3xN) considered as points in homogeneous form.
Set camera attitude
C.rpy(R, p, y) sets the camera attitude to the specified roll-pitch-yaw angles.
C.rpy(rpy) as above but rpy=[R,p,y].
© 1990-2012 Peter Corke.