
figure
subplot(231)
imshow(i)
第 2 页
title('灰度图像')
[m,n]=size(i)%求出图片的长宽
threshold=graythresh(i)%设立二值图像的阈值
bw=im2bw(i,threshold)%转换成二值图像
bw2=bwperim(bw,8)%按八连通求出图片的边缘
bw2=bwareaopen(bw2,10)%去除小于10个像素的单元 等于是排除了杂质
help regionprops,查看该函数的帮助文档,可以提取图像中某个区域的属性信息,例如区域的质心坐标等。
BW = imread('text.png')s = regionprops(BW, 'centroid')
centroids = cat(1, s.Centroid)
imshow(BW)
hold on
plot(centroids(:,1), centroids(:,2), 'b*')
hold off
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)