MATLAB: Animal detection in thermal images

animal detectionflirImage Processing Toolboxthermalthermal images

Hello everyone. I'm a newbie to MATLAB and I'm kinda struck with a project which detects the animals from the given thermal image.
The tasks are as follows:
  1. Detect the animals and mark it with bounding boxes along with its temperature
  2. Enhancing the image when the contrast is not so good (background and the animal are not distinguishable )
For the above task, can someone plz suggest the methods applicable for detection. So far, I have tried to pre-process the images by masking technique so that I can improve the contrast of the image.
clc;clear;close;
img = imread('C:\Users\DIVYA MEENA\Desktop\1 (79).jpg');
img_gray = rgb2gray(img);
BW = imbinarize(img_gray);
maskedRgbImage = bsxfun(@times, img, cast(BW, 'like', img));
imshow(maskedRgbImage)
However, the above code dint help much.
Any help will be highly appreciated, Thanks in advance and sorry for the long question.
PS: I have attached my sample images.

Best Answer

It's best if you can get a background image with no animals in it, then subtract that from the frame with animals (possibly) in it. You'll need to determine this dynamically since the no-animals background image may change with time as the room changes temperature. So maybe you could check for a change, and if there has been no change for, say, 15 minutes, then declare that frame as a background image and subtract it from future frames.