图如上图。
fn = \'1.jpg\'; p = imread(fn); imshow(p); [m,n,p] = size(p); hold on M = 10; % 水平分量 N = 10; % 垂直分量 lw = 0.1; % 划线宽度 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\',\'g\',\'LineWidth\',lw); 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\',\'g\',\'LineWidth\',lw); end
效果图如下: