Remove Background from image and select the region of interest
2 次查看(过去 30 天)
显示 更早的评论
I have a image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200215/image.png)
and I want to remove the background and select Yellow and Red and my output should be
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200216/image.png)
How can I do it ?
thanks
0 个评论
采纳的回答
Image Analyst
2019-1-5
编辑:Image Analyst
2019-1-5
Try the Color Thresholder app on the Apps tab of the tool ribbon.
After color segmentation, you might also need bwareafilt() or bwareaopen() to get rid of all blobs other than the largest one in the mask (binary image).
mask = bwareafilt(mask, 1); % Extract largest blob only.
2 个评论
Image Analyst
2019-1-5
Run the app, then click the Export button. Tell it to generate the code as a function.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!