Output of number of people from a thermal image

2 ビュー (過去 30 日間)
Neha Tom Merin
Neha Tom Merin 2022 年 3 月 23 日
コメント済み: yanqi liu 2022 年 3 月 24 日
How is it possible to get number of people as output from a theral image?I've attached a thermal image.

回答 (2 件)

Image Analyst
Image Analyst 2022 年 3 月 23 日
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 件のコメント
Neha Tom Merin
Neha Tom Merin 2022 年 3 月 23 日
What changes should be made if I dont have a colorbar for my image?
Image Analyst
Image Analyst 2022 年 3 月 23 日
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.

サインインしてコメントする。


yanqi liu
yanqi liu 2022 年 3 月 23 日
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 件のコメント
Neha Tom Merin
Neha Tom Merin 2022 年 3 月 23 日
I tried for other images. But, it doesn't come out right. Attaching another one here.
yanqi liu
yanqi liu 2022 年 3 月 24 日
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));

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by