国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
用sobel算子求梯度的源代碼
作者:sagiltarivs      發(fā)表時間:2006-5-15 18:16:00
(但是,還需要做細化操作)
W_H = [ 1   2  1;                  % the model in the horizon direction
0   0   0;
-1  -2  -1];
W_V = [1 0 -1;                     % the model in the vetical direction
2 0 -2;
1 0 -1];
T = 0.165;                           % the threshold in the 2-value
I = imread('f:\chinalake.bmp','bmp');  % read the image
%I = imread('f:\rice.tif','tif');
[height,width] = size(I);
I1 = double(I);
I2 = zeros(height+2,width+2);      % put the image's data into a bigger array to void the edge
I2(2:height+1,2:width+1) = I1;
for i=2:height+1                   % move the window and calculate the grads
for j=2:width+1
sum1 = 0;                  % the cumulus
sum2 = 0;
for m=-1:1
for n=-1:1
sum1 = sum1 + W_H(m + 2,n + 2) * I2(i + m,j + n);
end
end
for m=-1:1
for n=-1:1
sum2 = sum2 + W_V(m + 2,n + 2) * I2(i + m,j + n);
end
end
grey = abs(sum1) + abs(sum2);
I1(i-1,j-1) = grey;
end
end
big = max(max(I1));                          % 歸一化
small = min(min(I1));
for i=1:height
for j=1:width
I1(i,j) = (I1(i,j)-small)/(big - small);  % 歸一化
if(I1(i,j) > T)
I1(i,j) = 1;                          % 二值化
else
I1(i,j) = 0;
end
end
end
imshow(I1);
關于細化可以參看形態(tài)學
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
GEI MATLAB 失敗
[轉載]萬能字典?為了自己,也為了孩子,收藏!!
萬能字典
萬能字典,為了自己,也為了孩子,收藏!
為了自己和孩子,請收藏萬能字典
《傾聽經(jīng)典 如夢迷離》
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服