Documentation Center

  • Trial Software
  • Product Updates

record

Record video from Camera Board

Syntax

  • record(mycamera,fileName,duration)

Description

record(mycamera,fileName,duration) records video from the Camera Board to a file on Raspberry Pi™.

Examples

expand all

Use the Camera Board

You can create a connection to the Camera Board, take a photograph, and record video.

Create a connection to the Raspberry Pi board.

mypi = raspi;

Create a connection to the Camera Board while changing the resolution, and assign that connection to a handle, mycam. The handle displays the Camera Board properties.

mycam = cameraboard(mypi,'Resolution','1280x720')
mycam = 

Cameraboard with Properties:

                    Name: Camera Board   
              Resolution: '1280x720'       (View available resolutions)
                 Quality: 10              (1 to 100)
                Rotation: 0               (0, 90, 180 or 270)
          HorizontalFlip: 0              
            VerticalFlip: 0              
               FrameRate: 30              (2 to 30)
               Recording: 0              

   Picture Settings
              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 use the same approach to change the values of many mycamera properties listed in the "Name-Value Pair Arguments" for cameraboard.

Record a 60 second video.

record(mycam,'myvideo.mp4',60)

Stop recording before the 60 seconds have elapsed.

stop(mycam)

Copy the video from the board to your host computer.

getFile(mypi,'myvideo.mp4','C:\MATLAB')

Delete the video file from the board to free up space.

deleteFile(mypi,'myvideo.mp4')

Input Arguments

expand all

mycamera — Connection to Camera Boardhandle

Connection to a Camera Board, specified as a handle.

Use cameraboard to create this connection.

Example: mycam

fileName — Video file namevideo file name

Video file name, specified as a string.

Example: 'myvideo.mp4'

Data Types: char

duration — Duration of recordingduration of recording

Duration of recording, specified in seconds.

Example:

Data Types: double

See Also

| | | | |

Was this topic helpful?