Main Content

preview

Preview live video data from IP camera

Add-On Required: This feature requires the MATLAB Support Package for IP Cameras add-on.

Description

preview(cam) creates a preview window that displays live video data for ipcam object cam. The preview window shows a live image from the IP camera and displays the camera URL, resolution, frame rate, magnification, and the timestamp.

example

Examples

collapse all

Preview your IP camera images before acquiring snapshots.

Create an object, cam, using the URL of the IP camera. The URL address is for a Motion JPEG (mjpeg) over HTTP stream. For information about finding the URL, see Find IP Camera URL.

cam = ipcam('http://172.28.17.104/video/mjpg.cgi')
cam = 

Display Summary for ipcam:

             URL: 'http://172.28.17.104/video/mjpg.cgi'
        Username: ''
        Password: ''
         Timeout: 10

Preview the image from the camera.

preview(cam)

The preview window opens and displays live video stream from your camera. The banner of the preview window shows the camera URL. You can see in the graphic that the URL matches what was used to create the object. The lower portion of the window shows the timestamp in seconds, resolution, the frame rate in frames per second, and the magnification. The timestamp and other information shown inside the frame are not part of the preview window; they are part of the display of that particular camera. Your camera may display something similar, or not display anything inside the frame. That display generally can be set from the camera properties, outside of MATLAB®.

After you preview the image, the next step is to acquire images using the snapshot function.

Version History

Introduced in R2015a