⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 代码23-3.txt

📁 matlab宝典书籍源码 全部代码 希望大家喜欢
💻 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 + -