Feature Detection - Part 1, image subtraction
Mostrar comentarios más antiguos
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 comentarios
James Carter
el 31 de Oct. de 2011
Image Analyst
el 31 de Oct. de 2011
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
el 2 de Nov. de 2011
Image Analyst
el 2 de Nov. de 2011
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
el 2 de Nov. de 2011
James Carter
el 2 de Nov. de 2011
Image Analyst
el 2 de Nov. de 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
el 3 de Nov. de 2011
Respuestas (1)
Image Analyst
el 27 de Nov. de 2011
0 votos
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!