Output of number of people from a thermal image
3 次查看(过去 30 天)
显示 更早的评论
How is it possible to get number of people as output from a theral image?I've attached a thermal image.
0 个评论
回答(2 个)
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 个评论
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
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 个评论
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));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!