You can color threshold an image acquired from a webcam using the Color Thresholder app. The Image Capture tab 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. See Install the MATLAB Support Package for USB Webcams (Image Acquisition Toolbox) for information on installing the support package.
Open the app using the
To add a live image from your webcam, select Load Image > Acquire Image From Camera to open the Image Capture tab.
On the Image Capture tab, 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 the Camera list.
Set properties for the camera to control the image. Click the Camera Properties field 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. The Preview window updates dynamically when you change a setting. When you are done setting properties, click outside of the box to close the properties list.
Use the Preview window as a guide to set up the image you want to acquire. The Preview window shows the live images streamed as RGB data.
Click Take Snapshot. The Choose a Color
Space dialog box opens and displays the four color space options:
Choose a color space by clicking the button of your choice. Your image displays in a new tab using the selected color space.
You can now perform color thresholding on the image. See Segment Image and Create Mask Using Color Thresholder App for information about processing the image.
If you want to save the image that you captured, click Export and select Export Images.
In the Export To Workspace dialog box, you can save the binary mask, segmented image, and the captured image. The Input RGB Image option saves the RGB image captured from the webcam.
You can take more snapshots, preview, or change camera properties at any time by clicking the Camera tab.