代码23-3.txt
来自「matlab宝典书籍源码 全部代码 希望大家喜欢」· 文本 代码 · 共 18 行
TXT
18 行
I = imread('circuit.tif');
rotI = imrotate(I,33,'crop'); % 图像旋转,该函数具体用法在本书13.3.3有介绍。
fig1 = imshow(rotI); % 显示处理后的图像。
BW = edge(rotI,'canny'); % 图像边界探测
figure, % 新建窗口
imshow(BW); % 显示图像
[H,theta,rho] = hough(BW);
figure, imshow(imadjust(mat2gray(H)),[],'XData',theta,'YData',rho,...% 设置显示属性
'InitialMagnification','fit');
xlabel('\theta (degrees)'), ylabel('\rho'); % 设置坐标轴标题
axis on, axis normal, hold on; % 设置轴属性
colormap(hot) % 设置色彩索引图
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
x = theta(P(:,2));
y = rho(P(:,1));
plot(x,y,'s','color','black');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?