Main Content

Acquire Live Images in the Color Thresholder App

您可以得到的图像颜色阈值从一个webcam using theColor Thresholderapp. TheImage Capturetab enables you to bring a live image from USB webcams into the app.

To begin color thresholding, add images that you acquire live from a webcam using the MATLAB®Webcam support. Install the MATLAB Support Package for USB Webcams to use this feature. SeeInstall the MATLAB Support Package for USB Webcams(Image Acquisition Toolbox)for information on installing the support package.

  1. Open the app using thecolorThresholderfunction.

  2. To add a live image from your webcam, selectLoad Image > Acquire Image From Camerato open the Image Capture tab.

  3. On theImage Capturetab, if you have only one webcam connected to your system, it is selected by default, and a live preview window opens. If you have multiple cameras connected and want to use a different one, select the camera in theCameralist.

  4. Set properties for the camera to control the image. Click theCamera Propertiesfield to open a list of your camera’s properties. This list varies, depending on your device.

    Use the sliders or drop-downs to change property settings. ThePreviewwindow updates dynamically when you change a setting. When you are done setting properties, click outside of the box to close the properties list.

  5. Use thePreviewwindow as a guide to set up the image you want to acquire. ThePreviewwindow shows the live images streamed as RGB data.

  6. ClickTake Snapshot. TheChoose a Color Spacedialog box opens and displays the four color space options:RGB,HSV,YCbCr, andL*a*b*.

  7. Choose a color space by clicking the button of your choice. Your image displays in a new tab using the selected color space.

  8. You can now perform color thresholding on the image. SeeSegment Image and Create Mask Using Color Thresholder Appfor information about processing the image.

  9. If you want to save the image that you captured, clickExportand selectExport Images.

    In the Export To Workspace dialog box, you can save the binary mask, segmented image, and the captured image. TheInput RGB Imageoption saves the RGB image captured from the webcam.

  10. You can take more snapshots, preview, or change camera properties at any time by clicking theCameratab.

See Also

Related Topics