Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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!

Akzeptierte Antwort

Thorsten
Thorsten am 23 Okt. 2015
Bearbeitet: Thorsten am 23 Okt. 2015
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

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by