How can I crop an object in an image without actually knowing where in the image the object is located?

1 回表示 (過去 30 日間)
I have attached the images of two cashew types. The first is knows as the 'Butts B' type and the other known as the 'Dessert Pieces'. The images are obtained by a camera capturing images of cashews that are on a conveyor belt below it. There is no way for me to know how many cashews will be present in the image. What I need to do is extract each cashew in a single image (binary image), analyze it (I have the code for analyzing the length, width and color of one cashew/image) and move to the next cashew in the same image. The greater aim of the project is to grade cashew based on their length, width and color. I have not able to make any progress in this area and I would be grateful if someone could help me out in this. Thank You!

採用された回答

Thorsten
Thorsten 2015 年 10 月 23 日
編集済み: Thorsten 2015 年 10 月 23 日
I = imread('ButtsB.jpg');
Convert to binary (for example, using R layer of image and threshold 100):
B = I(:,:,1) > 100;
S = regionprops(B);
for i = 1:numel(S);
Ii = imcrop(I, S(i).BoundingBox);
imshow(Ii);
disp('Press return to continue.'), pause
% work on Ii
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by