bwl.m

来自「图像像素级边缘检测程序」· M 代码 · 共 41 行

M
41
字号
clear;
figure;
RGB = imread('G:\课题\61.bmp');
I  = rgb2gray(RGB);
imshow(I);

Template1=fspecial('average');
I=filter2(Template1,I)/255;
I=filter2(Template1,I);

BW = edge(I,'sobel'); 

figure;
BW(1:3,1:736)=0;
BW(452:454,1:736)=0;
BW(1:454,1:3)=0;
BW(1:454,734:736)=0;
imshow(BW);

figure;
subplot(1,2,1),imshow(I)
subplot(1,2,2),imshow(BW)

[H,T,R] = hough(BW,'RhoResolution',0.2,'ThetaResolution',1);
%imshow(imadjust(mat2gray(H)),'XData',T,'YData',R,...'InitialMagnification','fit');
%title('Hough transform of gantrycrane.png');
%xlabel('\theta'), ylabel('\rho');
%axis on, axis normal, hold on;

PIC=mat2gray(H);
imwrite(PIC,'G:\课题\pic.bmp')

d1=max(max(PIC));
a1=find(PIC==d1);
b1=round(a1/8633);%列数
c1=mod(a1,8633);  %行数

%again a2=?
%dc=a1;
%db=a2;
%ask=1.2*(dc-db);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?