![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
人数统计算法matlab程序。实现图像处理最后统计人数。有偿回报
头发区域面积应该在一定范围内 衣服区域应该很大
所以区域面积在一定范围内看做是人头 否则就去除
可以用regionprops内的area去判断 同时加上长短轴 这里贴一个简单例子
clc; clear all; close all;
I = imread('c:\\ce.jpg');
I1 = rgb2gray(I);
bw1 = im2bw(I1, graythresh(I1));
bw1 = ~bw1;
bw2 = imopen(bw1, strel('disk', 10));
bw2 = bwareaopen(bw2, 500);
bw3 = bwareaopen(bw2, 1000);
bw4 = bw2.*(~bw3);
[L, num] = bwlabel(bw4);
Lrgb = label2rgb(L, 'jet', 'w', 'shuffle');
figure;
subplot(3, 2, 1); imshow(I)
subplot(3, 2, 2); imshow(I1)
subplot(3, 2, 3); imshow(bw1)
subplot(3, 2, 4); imshow(bw2)
subplot(3, 2, 5); imshow(bw4)
subplot(3, 2, 6); imshow(I)
hold on;
himage = imshow(Lrgb);
set(himage, 'AlphaData', 0.5);
广告 您可能关注的内容 |