資源簡介
這個程序是我自己編程寫的,不是調用原函數,對初學者幫助應該比較大。
代碼片段和文件信息
clear;
[amap]?=?imread(‘C:\Users\chengyuqing\go.jpg‘);
a1?=?rgb2gray(a);
figure;imshow(a1);
%?************單方向梯度算子(gradient?operator)處理************
%?***********單方向銳化:包括水平方向與垂直方向上的銳化***********??
a1?=?double(a1);
[GxGy]?=?gradient(a1);?????????????%?計算梯度
G?=?sqrt(Gx.*Gx?+?Gy.*Gy);?????????%?水平垂直差分
out?=?G;?
figure;imshow(outmap);title(‘gradient?operator‘);
%?*********************Laplacian算子************************
%?*****K?=?fspecial(‘laplacian‘0.7);K1?=?filter2(KI)/100;*****
%?*****fepecial(typepara)其中type指定算子的類型,para指定相應的參數*****
%?laplacian算子取值范圍[01]
H?=[?0??-1??0??
???-1???4??-1??
????0??-1??0?];??
J?=?conv2(a1H‘same‘);????????%行方向上卷積,same表示結果與a1取相同部分
J1?=?uint8(J);
figure;imshow(J1);title(‘laplacian‘);?
%?*********************Sobel算子************************
%?*****L?=?fspecial(‘sobel‘);L1?=?filter2(LI)
- 上一篇:MATLAB仿真mac協議
- 下一篇:yolomatlab.zip
評論
共有 條評論