Acquire Live Images in Color Thresholder
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
colorThresholder
function.To add a live image from your webcam, select Load Image > Acquire Image From Camera.
The Import from Camera dialog box opens and displays camera properties and a live preview of the webcam. If you have only one webcam connected to your system, then it is selected by default. If you have multiple cameras connected and want to use a different one, select the camera in the Camera list.
Use the sliders or drop-downs to change property settings. The list of camera properties varies, depending on your device. The live preview updates dynamically when you change a setting.
After you adjust the camera settings, click Capture to capture a static image from the webcam. If you want to use this static image for color thresholding, then click Accept. Otherwise, you can click Retake to capture a new static image.
The Choose a Color Space tab opens and displays the four color space options: RGB, HSV, YCbCr, and L*a*b*. Choose a color space by clicking the button of your choice.
The Color Thresholder app creates a new tab displaying the image and the color component controls for the selected color space. You can now perform color thresholding on the image. See Segment Image and Create Mask Using Color Thresholder 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.