p = imread('C:\Users\源氏\Desktop\数据库\B1.png');
%p=rgb2gray(p);
imshow(p);
[m,n] = size(p);
hold on
M =2; % 水平分量
N =3; % 垂直分量
mx = ones(1,M+1);
my = linspace(1,m,M+1);
% 画水平线
for k = 1:M+1
line([mx(k) n*mx(k)],[my(k) my(k)],'color','w');
end
nx = linspace(1,n,N+1);
ny = ones(1,N+1);
% 画垂直线
for k = 1:N+1
line([nx(k) nx(k)],[ny(k) m*ny(k)],'color','w');
end