%噪声边界的应用
f=imread('bottle_1.tif');
subplot(2,3,1),imshow(f),title('对像')
b = boundaries(f, 4, 'cw');
b = b{1};
[M, N] = size(B);
xmin = min(b(:, 1));
ymin = min(b(:, 2));
[x, y] = minperpoly(f, 8);%使用函数minperpoly得到最小周长多边形
[M,N]=size(f);
b2 = connectpoly(x, y);
B2 = bound2im(b2, M, N, xmin, ymin);
subplot(2,3,2),imshow(B2),title('最小周长多边形')
[xn, yn] = randvertex(x, y, 5)%每个顶点添加噪声
[xn, yn] = minperpoly(f, 8);%以下程序跟上个相同
[M,N]=size(f);
b2 = connectpoly(xn, yn);
B2 = bound2im(b2, M, N, xmin, ymin);
subplot(2,3,3),imshow(B2),title('噪声边界')
%另外一个对象的相同序列
f=imread('bottle_2.tif');
subplot(2,3,4),imshow(f),title('对像')
b = boundaries(f, 4, 'cw');
b = b{1};
[M, N] = size(B);
xmin = min(b(:, 1));
ymin = min(b(:, 2));
[x, y] = minperpoly(f, 8);
[M,N]=size(f);
b2 = connectpoly(x, y);
B2 = bound2im(b2, M, N, xmin, ymin);
subplot(2,3,5),imshow(B2),title('最小周长多边形')
[xn, yn] = randvertex(x, y, 5)
[xn, yn] = minperpoly(f, 8);
[M,N]=size(f);
b2 = connectpoly(xn, yn);
B2 = bound2im(b2, M, N, xmin, ymin);
subplot(2,3,6),imshow(B2),title('噪声边界")
噪声边界的应用
最新推荐文章于 2020-05-02 14:12:41 发布