http://blog.sina.com.cn/s/blog_5dd2e9270100xdcp.html
代码不能运行,不知道咋回事
poison matting matlab code
注:显示图像后,单击鼠标左键连出完全背景区域,双击左键结束;
图像改变后,再单击鼠标左键连出完全前景区域,双击左键结束。即可得到结果。
A=imread(‘ppmm2.bmp‘);
imshow(A);
hold on;
Threshold = 1;
UniBack=[0
0
255];
% choose background object, and B results into the Foreground Object and the
% Boundary Region
% choose the outer line of the boundary region. Single left click the mouse to specify vertice.Double left click or single right click to finish;
OuterBW = roipoly(A);
B(:,:,1) = immultiply(A(:,:,1),OuterBW);
B(:,:,2) = immultiply(A(:,:,2),OuterBW);
B(:,:,3) = immultiply(A(:,:,3),OuterBW);
Back(:,:,1) = immultiply(A(:,:,1),~OuterBW);
Back(:,:,2) = immultiply(A(:,: