Matlab自己实现Sobel边缘提取和ROA边缘提取
来源:互联网 发布:java程序员学php 编辑:程序博客网 时间:2024/05/17 01:51
Sobel梯度强度图G
提取梯度强度本质是一种滤波,同高斯模糊滤波一样,只不过所用算子(kernel)不同,sobel梯度图所用的算子如下两个矩阵,分别同图像A做卷积,得到两个大小与A相同的二维浮点矩阵Gx、Gy:
求Gx和Gy两个矩阵的平方和根号,得到二维浮点矩阵:
浮点矩阵G就是图像A的梯度强度图,大小与A相同的。
Matlab实现Sobel边缘提取
%copyright by Institute of Electronic ,Chinese Academy of Sciences%get the gradient edge of optical image by sobel methodfunction [ G ] = Sobel( Image )Image=double(Image);h=[-1 -2 -1;0 0 0;1 2 1]; Gx=filter2(h,Image); %Gx is the gradient of x axel Gy=filter2(h',Image); %Gy is the gradient of y axel G=sqrt(Gx.^2+Gy.^2); %amplitude of gradientG=255*G./max(G(:));G=uint8(G); %trans from double to uint8figure;imshow(G);end
原图
Sobel梯度强度图
2. ROA梯度强度图
合成孔径雷达图像作为遥感图像,有强烈的斑点噪声,ROA可以通过取平均的方式来减少影响。提取SAR图像B所使用的梯度提取算子与上面不同,具有四个模板算子,如下图所示,所用算子为四个模板,, 分别是当前像素第k对的边侧区域像素的平均灰度值。
以水平方向模板为例,中心像素为B(i,j),、的值定义为:
根据以上式子分别计算四个模板的R值,并取其中最大值为最终R值,定义为:
对每个像素做以上计算后,可以得到所有像素对应的R值,ROA梯度强度图的定义如下,大小与B相同。
Matlab实现ROA边缘提取
copyright by Institute of Electronic ,Chinese Academy of Sciences%get the gradient edge of SAR image by ROA methodfunction [ G ] = ROA( Image )Image=double(Image);[m,n]=size(Image);G=zeros(m,n);for j=1:n-1 for i=1:m-1 if i>=2 && i<=m-1 && j>=2 && j<=n-1 %horizontal P1=mean(Image(i-1,j-1:j+1)); Q1=mean(Image(i+1,j-1:j+1)); R1=max(P1/Q1,Q1/P1); %this step is extremly dangerous,since Q1 or P1 might be zero. %vertical P2=mean(Image(i-1:i+1,j-1)); Q2=mean(Image(i-1:i+1,j+1)); R2=max(P2/Q2,Q2/P2); %45 degree left div P3=mean([Image(i,j-1),Image(i+1,j-1),Image(i+1,j)]); Q3=mean([Image(i-1,j),Image(i-1,j+1),Image(i,j+1)]); R3=max(P3/Q3,Q3/P3); %135 degree right div P4=mean([Image(i-1,j-1),Image(i,j-1),Image(i-1,j)]); Q4=mean([Image(i+1,j+1),Image(i,j+1),Image(i+1,j)]); R4=max(P4/Q4,Q4/P4); % find the max R G(i,j)=max([R1,R2,R3,R4]); %in case of the value of G(i,j) is inf if G(i,j)>=255 G(i,j)=0; end; end; end;end;G=255*G./max(G(:));%the value of R vary around 1G=uint8(G); figure;imshow(G);end
0 0
- Matlab自己实现Sobel边缘提取和ROA边缘提取
- Sobel,LoG,Canny边缘提取算法的实现和比较
- Sobel边缘提取算法(DSP)
- Sobel边缘提取算法(DSP)
- Halcon实现边缘提取
- 图像特征提取:Sobel边缘检测
- 图像特征提取:Sobel边缘检测
- 再说边缘特征提取sobel算子
- 再说边缘特征提取sobel算子
- 【Matlab】Canny算子提取边缘
- 边缘提取
- 边缘提取
- opencv实现canny边缘提取
- Sobel边缘检测(matlab)
- opencv提取图像边缘特征sobel算子的运用
- 小波变换边缘提取程序MATLAB
- Canny算子提取边缘Matlab源代码
- Sobel 边缘实现
- Linux 命令tr
- 差不vc呢你地方的多少
- AC3/EAC3格式总结
- XCode6.1 无法连接SVN https
- HDU1022 Train Problem I
- Matlab自己实现Sobel边缘提取和ROA边缘提取
- Redis的Python
- Axis2实现web service接口开发+客户端调用
- 欢迎使用CSDN-markdown编辑器
- 获奖转盘
- Plus One
- sgu207:Robbers(贪心)
- wxWidgets初学者导引
- c#创建带参数的线程