用Matlab计算一幅二值图像中目标的面积(也就是像素数表示),如何计算?
来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/11/08 07:48:28
用Matlab计算一幅二值图像中目标的面积(也就是像素数表示),如何计算?
图像是c
我用的是bwarea(c)函数,计算出的像素数是1760个
但是用 >>[l,num]=bwlabel(c);
>>stats=regionprops(l,'Area');
>> A=stats.Area;
计算出的是1710个,我想知道为什么两个计算结果不一样呢,差了50个像素呢,
图像是c
我用的是bwarea(c)函数,计算出的像素数是1760个
但是用 >>[l,num]=bwlabel(c);
>>stats=regionprops(l,'Area');
>> A=stats.Area;
计算出的是1710个,我想知道为什么两个计算结果不一样呢,差了50个像素呢,
sum(c(:))试一下.我猜结果应该是1710.
你doc bwarea看一下,有下面这些话
total = bwarea(BW)
Description
total = bwarea(BW) estimates
the area of the objects in binary image BW. total is
a scalar whose value corresponds roughly to the total number of on pixels
in the image, ****but might not be exactly the same because different
patterns of pixels are weighted differently****.
你doc bwarea看一下,有下面这些话
total = bwarea(BW)
Description
total = bwarea(BW) estimates
the area of the objects in binary image BW. total is
a scalar whose value corresponds roughly to the total number of on pixels
in the image, ****but might not be exactly the same because different
patterns of pixels are weighted differently****.