This example shows how to create a connection to the Camera Board, capture still images, and record video.
Create a connection to the Raspberry
Pi™ hardware using
mypi = raspi
Create a connection to the Camera Board and assign the
connection to a handle,
mycam. You can use Name-Value
pairs to override the default values of most properties, like the
mycam = cameraboard(mypi,'Resolution','1280x720')
mycam = cameraboard with properties: Name: Camera Board Re '1280x720' (View available resolutions) Rotation: 0 (0, 90, 180 or 270) HorizontalFlip: 0 VerticalFlip: 0 FrameRate: 30 (2 to 30) Recording: 0 Quality Brightness: 50 (0 to 100) Contrast: 0 (-100 to 100) Saturation: 0 (-100 to 100) Sharpness: 0 (-100 to 100) Exposure and AWB ExposureMode: 'auto' (View available exposure modes) ExposureCompensation: 0 (-10 to 10) AWBMode: 'auto' (View available AWB modes) MeteringMode: 'average' (View available metering modes) Effects ImageEffect: 'none' (View available image effects) VideoStabilization: 'off' ROI: [0.00 0.00 1.00 1.00] (0.0 to 1.0 [top, left, width, height])
Import and display a sequence of ten snapshots on your host computer.
for ii = 1:10 img = snapshot(mycam) imagesc(img) drawnow end
If the image is upside down, change the orientation of the image.
mycam.Rotation = 180
You can change the values of many
listed in the "Name-Value Pair Arguments" for
Record a 10 second video.
Before the specified number of seconds have elapsed, you can stop recording video.
Copy the video from the board to your host computer.
To free up space, delete the video from the board.