SimpleColorDetection()
This script is a demo that shows you how to find objects of a certain color in an image. For this example I'm using the standard onion, peppers, or canoe image that ships with the Image Processing Toolbox. You can also select one of your own color images instead if you wish. Then I separate the image into its component red, green, and blue color bands. I compute thresholds, and ultimately find a mask for the red objects. Prompts will guide you through the demo step by step. I multiply this mask by the original image to show the image with only the red objects showing and everything else blacked out. This script can be adapted to find other colors (white, green, blue, yellow, etc.)
If you want to do any measurements of the red objects, I refer you to my blob measurement demo file at//www.tatmou.com/matlabcentral/fileexchange/25157
Requires the Image Processing Toolbox. Tested with R2008b and R2010a.
Cite As
图像分析师(2022)。SimpleColorDetection()(//www.tatmou.com/matlabcentral/fileexchange/26420-simplecolordetection), MATLAB Central File Exchange. Retrieved.
MATLAB释放兼容性
Platform Compatibility
视窗 macOS LinuxCategories
- Image Processing and Computer Vision>Image Processing Toolbox>
- Image Processing and Computer Vision>Image Processing Toolbox>Import, Export, and Conversion>
- Image Processing and Computer Vision>Image Processing Toolbox>Display and Exploration>
- Image Processing and Computer Vision>Image Processing Toolbox>Image Segmentation and Analysis>
- Image Processing and Computer Vision>Image Processing Toolbox>Image Segmentation and Analysis>Image Segmentation>图像阈值>
- Image Processing and Computer Vision>Image Processing Toolbox>Import, Export, and Conversion>Color>
Tags
Acknowledgements
Inspired:Extract Red Objects from Aerial Image,Colour based segmentation,SimpleColorDetectionByHue(),Color Detection and Separation using Matlab, Arduino &Webcam
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
开始狩猎!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.