필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Image 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