Feature Detection - Part 1, image subtraction

3 views (last 30 days)
I'm a newbie to image processing, and wondered if someone could point me in the right direction. My goal is to take an image of a buck and identify its antlers and determine the Max Height and Max Width of the antlers (first in pixels and then an estimate real size from measured the distance to the target). The set of photos can be located at the following URL:
Antlers7.jpg is the image under analysis. Antlers7 subt2.jpg is a fudged photo. Our camera did not capture an image without the bucks, so I used a clone tool on a Photoshop- like program to block out the target buck. The results would have been more difficult with the other buck standing behind the target. That's why you see half a buck there to be subtracted out. I can deal with this complication later.
I = imread('Antlers7.jpg');
J = imread('Antlers7_subt2.jpg');
Ig = rgb2gray(I);
Jg = rgb2gray(J);
seline1 = strel('line',5,45);
Jgfdl = imdilate(Jg, seline1);
JgRcon = imreconstruct(Jgfdl, Jg);
Ip = Ig - JgRcon;
imshow(Ip);
This resulted in subtract2.jpg. It appeared that running a dilation on the background image (w/out buck) and a reconstruct resulted in the complete dropping of background without any noise. The background is completely black, compared to when I do a direct subtraction or use any other filtering method. The issue with this is that the antlers themselves have some zones that are completely black, so this results in loss of information.
IgCadj = imadjust(Ig,[],[],0.6);
Ip = IgCadj - JgRcon;
imshow(Ip);
When I change the gamma on the image under investigation, and then take the difference, the resulting image is Image Subtract.jpg. While some background texture appears, the animal is clearly delineated.
Running edge detection at this point does not work because of all the internal contours are highlighted as well. My eye can clearly see a boarder but don't know how to capture this with matlab. I did run improfile on the background and the foreground and there is a definite difference in range of intensities but there is overlap so this makes filtering the one from the other more difficult.
I want to generate an outline of the animal which I can then apply as a mask to the original gray scale image. Any suggestions on how to achieve this would be greatly appreciated.
  8 Comments
Image Analyst
Image Analyst on 2 Nov 2011
pixelsToChange = (Ip>5) & (Ip < 50);
I2(pixelsToChange) = 255;
Note the single &. But I can tell you right now you'll never find antlers via simple thresholding.
James Carter
James Carter on 3 Nov 2011
Yes, I know. I'm using your input to let people know that this will not be a trivial exercise. Thanks

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 27 Nov 2011

Categories

Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!