Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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!

Respuesta aceptada

Thorsten
Thorsten el 23 de Oct. de 2015
Editada: Thorsten el 23 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Image Processing and Computer Vision en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by