"Camera" (General OS-Supported Camera)

"Camera" provides a general interface for communicating with imaging devices, such as USB webcams, using operating system-supported drivers.
Imaging devices can be built-in or connected via USB, firewire, etc.
Available cameras can be found using $ImagingDevices or FindDevices.

Device Discovery

  • FindDevices["Camera"] lists the camera devices connected to your system.
  • $ImagingDevices gives a list of names of available cameras.

Opening the Device

Configuring the Device

Device Properties

  • The following native properties are available:
  • "DeviceName"Automaticname of the camera
    "FrameRate"Automaticrate at which frames are collected
    "RasterSize"Automaticcamera resolution for capturing frames
    "SupportedCameraResolutions"Automaticimage resolutions supported by the camera
    "Timeout"Automaticidle time until camera is automatically closed
  • The Automatic setting for "FrameRate" is 12 frames per second.
  • Possible values for "RasterSize" are of the form {width,height}.
  • The Automatic setting for "RasterSize" is {320,240}.
  • A connected camera that is left idle for the period specified by the "Timeout" option will be automatically disconnected. The Automatic setting for "Timeout" corresponds to 120 s. "Timeout" can also be set to Infinity.

Reading Data

Closing and Releasing Resources

    DeviceClose[dev]

    stops capture, closes the camera connection, and frees related resources.

Examples

Basic Examples  (6)

Open the default camera using default settings:

In[1]:=
Click for copyable input
Out[2]=
In[7]:=
Click for copyable input
Out[7]=

Close the device:

In[8]:=
Click for copyable input

Automatically open the default camera using CurrentImage:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Use the Devices function to find the associated DeviceObject:

In[3]:=
Click for copyable input
Out[3]=

Close the camera with DeviceClose:

In[4]:=
Click for copyable input

Open the specified camera:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Open the specified camera with parameters:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input

Change camera settings by setting device properties:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=

Change camera settings with DeviceConfigure:

In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input

Use DeviceRead to capture an image from an opened camera:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input

Capture a TimeSeries of images:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input

See Also

CurrentImage  ImageCapture  FindDevices  $ImagingDevices  $ImagingDevice  $DefaultImagingDevice  Image