MATLAB Answers

Foreground Object Detection from Reconyx Camera Trap Images

1 view (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 18 Nov 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 Comments
Image Analyst
Image Analyst on 20 Nov 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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by