Foreground Object Detection from Reconyx Camera Trap Images

2 visualizaciones (últimos 30 días)
I have a series of images (upwards of 100) from a Reconyx motion triggered camera, observing a compost pile, with images of animals present in the scene. They are not in constant seqeunce (i.e not like you would expect if you took a video fram by frame). What would be the best method to obtain the contours or the edges of the animal(s) present in the images while removing the background(noting that all of the images more or less share the same background). Attached are some images with just the background, and some with animals present in the foreground.

Respuesta aceptada

Image Analyst
Image Analyst el 18 de Nov. de 2018
I'd subtract the background from the test image, then threshold and do some size filtering, then mask.
diffImage = abs(double(grayImage) - double(backgroundImage));
animalMask = diffImage > 5; % Whatever works
animalMask = imfill(animalMask, 'holes');
animalMask = bwareafilt(animalMask, [100, inf]); % Take only the larger blobs.
maskedImage = grayImage; % Initialize.
maskedImage(~mask) = 0; % Or whatever gray level you want, such as mean(grayImage(~mask));
Adapt as needed. Let me know if you still need help.
  2 comentarios
Hyung Jun Kim
Hyung Jun Kim el 19 de Nov. de 2018
Hi Mr Image Analyst,
Thank you for your quick response!
I tried out your methods, and for the most part it worked like a charm! Attached below is what I've done using your suggestions. As you see, the outline that I get of the figure filled with the "larger blobs" looks good when using samp9.jpg image and the background.jpg. However, the problem I have is when I try the same method with the same difference values for "animalMask" regarding images with smaller and more discrete animals present in the photos (such as samp2.jpg attached above).
I understand that sharper the contrast of the animalMAsk, the most pixel values are rejected, making it harder for the smaller animals to form "large blobs" to derive the animal contours.
Is there a way around this so that I can obtain clearer outlines for the smaller animals as well, while being able to reject the background?
Thank you in advance!
grayImage= imread('samp9.jpg');
grayImage= rgb2gray(grayImage);
backgroundImage= imread('background.jpg');
backgroundImage= rgb2gray(backgroundImage);
diffImage = abs(double(grayImage) - double(backgroundImage));
animalMask = diffImage > 30; % Whatever works
animalMask = imfill(animalMask, 'holes');
animalMask = bwareafilt(animalMask, [300, inf]); % Take only the larger blobs.
maskedImage = grayImage; % Initialize.
maskedImage(animalMask < .8) = 0; % Or whatever gray level you want, such as mean(grayImage(~mask));
imshow(maskedImage);
Image Analyst
Image Analyst el 20 de Nov. de 2018
Well your haystack is a lot different so it's finding a lot of hay. You're going to have to put in a lot of work to make it robust for hay disturbance. But this is what I got for you now. See attached files.
0000 Screenshot.png

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by