Output of number of people from a thermal image

2 views (last 30 days)
How is it possible to get number of people as output from a theral image?I've attached a thermal image.

Answers (2)

Image Analyst
Image Analyst on 23 Mar 2022
Yes. First of all use the actual temperature image, not this pseudocolored RGB image. Then threshold at some temperature to get a binary image. Then call bwareafilt() to get rid of blobs that are too big or too small to be a person. Then call bwlabel() to count the number of blobs.
See my Image Segmentation Tutorial in my File Exchange:
  8 Comments
Neha Tom Merin
Neha Tom Merin on 23 Mar 2022
What changes should be made if I dont have a colorbar for my image?
Image Analyst
Image Analyst on 23 Mar 2022
Then you can't convert to temperature. Or you could just assume some colormap. Otherwise you'll have to just work on the pseudocolor image (like yanqi did), but conversion from RGB to gray scale is not linear at all, so that method is not reliable. For example, the gray scale of one color may be the same as that of a completely different color. You'd be best off trying to construct some kind of colormap to convert RGB into temperature.

Sign in to comment.


yanqi liu
yanqi liu on 23 Mar 2022
im = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/938099/rgb.png');
jm = rgb2lab(im);
bw = im2bw(mat2gray(jm(:,:,2)), 0.8);
bw = bwareaopen(bw, 500);
stats = regionprops(bw);
num = length(stats);
figure; imshow(im, []);
for i = 1 : num
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
end
title(sprintf('共%d个候选目标', num));
  2 Comments
Neha Tom Merin
Neha Tom Merin on 23 Mar 2022
I tried for other images. But, it doesn't come out right. Attaching another one here.
yanqi liu
yanqi liu on 24 Mar 2022
yes,sir,it is one simple method for target image,so if we change image,may be should change some process step,such as
im = imread('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/938954/gui.jpeg');
jm = rgb2lab(im);
bw = im2bw(mat2gray(jm(:,:,3)), 0.5);
bw = bwareaopen(imclearborder(bw), 1000);
stats = regionprops(bw);
num = length(stats);
figure; imshow(im, []);
for i = 1 : num
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
end
title(sprintf('共%d个候选目标', num));

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!