How can I isolate objects in image?
조회 수: 17 (최근 30일)
이전 댓글 표시
Hello, I have an image that contains some chickens photographed from a top view, and I would like to count them through a Matlab function. My problem is that the chickens are so similar, in color, to the floor, making it difficult to go by the color. Also, since to ground is 'pointed', it is also difficult to go by texture, since the textures also seem kind of similar. These are some of the images it should be able to count:
and somee more similar to this ones. It is not a big problem if the function does not count the ones that are moving, once those sometimes are blurred, I'm only concerned with the static one's. Any help would be appreciated!
댓글 수: 0
답변 (2개)
Changoleon
2016년 11월 7일
Hi,
First of all, I would convert the image to grayscale. You can use rgb2gray or mean('name',3)
Next you should apply otsu's method (graythresh in Matlab) to find the threshold of the image. But as you said there is not too much difference between the chickens and the background. You could do some sort of filtering before applying grayhtresh to make the image smooth, and then find the threshold. Using that threshold, you can segment the image so that you end up only with your chickens. At the end, you can use [L,num] = bwlabel(segmented_image);
One more approach which is more reliable is cross-correlation. Once you find the aprroximate shape of one chicken, other chickens in the picture should look like the one you found ( more or less). Then you can count them.
댓글 수: 0
Image Analyst
2016년 11월 7일
Because the chickens are essentially the same color as the sand simply thresholding a gray scale image or even doing color segmentation is unlikely to be very robust. You might try a texture filter like stdfilt() or entropyfilt() but I even have doubts about that. I'd try optical flow in the Computer Vision System Toolbox. https://www.mathworks.com/products/computer-vision/features.html#object-tracking-and-motion-estimation
You might try optical filtering. I'd get the reflective spectrum of the chickens and of the sand and use a notch filter in front of the lens that is in the part of the optical spectrum where the chickens and the sand have the greatest reflectivity.
If you have some more money you can try a cheap thermal camera, assuming the sand and the chickens are not the same temperature.
댓글 수: 4
Image Analyst
2016년 11월 9일
But the chickens aren't white, or not totally white. And blurring might change the color of the white in the floor but it will also change the color of the white in the chickens. Maybe you should use size filtering instead.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!