How to extract an object from an image
Show older comments
I've got this code to extract a single cashew from a image containing multiple cashews. I need the extracted image to be RGB as well.
cashew_RGB = imread('White Wholes 180.jpg');
cashew_BW = img_BW(cashew_RGB);
cashew_stats = regionprops(bwlabel(cashew_BW),'BoundingBox');
cashew_single = imcrop(cashew_RGB,cashew_stats(i).BoundingBox);
I have attached the image and the user-defined function 'img_BW' which converts RGB image to black and white If you execute the code you'll find that the extracted cashew image has an invasion from the neighboring cashew. Is there any way to extract the cashew without such invasions? Thanks for your help!
Accepted Answer
More Answers (2)
r r
on 8 Aug 2018
0 votes
I have an image I want to extract the small areas of black color within the blue How so؟؟؟
1 Comment
Image Analyst
on 8 Aug 2018
Start your own new, separate question and I'll show you how.
Arnab Banerjee
on 13 Sep 2019
0 votes
first, convert to gray, by rgb2gray(), then find the perfect threshold of the region from the image matrix. it can be aslo done in RGB image if you knew the R:G:B ration of the threshold.
lastly, past the bounded area in a mask, or extract the partcular threshold
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!