📄 代码23-3.txt
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -