Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Thorsten
Thorsten il 23 Ott 2015
Modificato: Thorsten il 23 Ott 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

Più risposte (0)

Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by