Feature Detection - Part 1, image subtraction

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

James Carter
James Carter 2011년 10월 31일
Running improfile again, it appears that the target gets intensities that start at 0 and go up to 250, while the background starts at 0 and goes no higher than 50. The whiter elements are what distinguish the target. It seems to me that if you search for pixels with greater than intensity of 50 and convert them to 0, and then take pixels with intensity of between say 5 and 50 and convert them to 255, you may get a closer representation of the object (very close to binary), though I don't know yet what artifacts will be produced. How do you take pixels with specific intensities and redefine them?
Image Analyst
Image Analyst 2011년 10월 31일
Why are you doing this? It looks pretty tough for a first project in image analysis. Can't you choose an easier project to start out with?
James Carter
James Carter 2011년 11월 2일
Our company produces a game camera, and for a second generation camera project they are thinking of adding this feature. We may hire a person with Image Processing background, or at least hire a consultant, but for now I wanted to see what I could do with it, to get a sense of the difficulty involved.
Image Analyst
Image Analyst 2011년 11월 2일
I would say it's pretty challenging, and I've been doing image analysis every day for over 30 years. With the variety of backgrounds that could be in the scene, the orientation of the animal in the scene, the variability in lighting, the variability of number of points (from 0 to 10 or whatever), . . . it looks tough. You might take a look near the end of this page: http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/98/normand/main.html - perhaps doing something like that jet identification they did by using the Hausdorf distance might work.
James Carter
James Carter 2011년 11월 2일
Would I gain anything using computer vision (e.g., surf method) or not really - ultimately has the same limitations.
James Carter
James Carter 2011년 11월 2일
OK. I see that you should clone the Image. I2 = Ip. Then you use Ip as an argument of I2 to set a condition: I2(Ip > 50) = 0; But if I use a logical combination I2(( Ip > 5 ) && ( Ip <= 50)) = 255; I get the following complaint: Operands to the || and && operators must be convertible to logical scalar values. How can I achieve "pixels values above 5 AND below or equal to 50 get set to 255"?
Image Analyst
Image Analyst 2011년 11월 2일
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 2011년 11월 3일
Yes, I know. I'm using your input to let people know that this will not be a trivial exercise. Thanks

댓글을 달려면 로그인하십시오.

질문:

2011년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by