This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Use the Raspberry Pi Web Camera to Capture Images

This example shows how to create a connection to the web camera and capture still images.

Connect the Raspberry Pi™ board to your host computer.

Note

If you have not previously configured your Raspberry Pi board, see Hardware Setup.

Create a connection to the Raspberry Pi hardware using raspi.

mypi = raspi

Create a connection to the webcam and assign the connection to a handle, mycam. You can optionally override the default Resolution property, shown here.

mycam = webcam(mypi)
mycam = 

  webcam with properties:

                    Name: '/dev/video0'
              Resolution: '320x240'
    AvailableResolutions: {'320x240'  '640x480'}

Import and display a sequence of ten snapshots on your host computer.

for ii = 1:10
img = snapshot(mycam)
    imagesc(img)
    drawnow
end

See Also

|