删除图像中的小块标签

时间:2013-07-02 15:24:57

标签: matlab image-processing computer-vision image-segmentation

我在MATLAB中也是图像处理的新手,我试图逐帧定位一个人。到目前为止,我已经标记了这样的裁剪图像(使用PeopleDetector裁剪),现在如果我找到人的确切位置,即在哪个像素位置'1'开始和结束(我知道这不是正确的逻辑)。

我想要的只是在人的右侧移除一小块白色像素。我不知道该怎么做。请建议我。

enter image description here

2 个答案:

答案 0 :(得分:4)

您可以使用bwareaopen

bwareaopen(A, P)

这将从二进制图像P中删除所有像素少于A的对象。

答案 1 :(得分:3)

使用regionprops

>> props = regionprops( bwlabel( mask, 4 ), 'Area', 'PixelIdxList' );
>> smallRegions = [props(:).Area] < minNumPixels; % select the small regions
>> mask( [props( smallRegions ).PixelIdxList ] ) = 0; % reset small regions