Sobel算子实现水平边缘检测、垂直边缘检测;45度、135度角边缘检测
2013-04-25 17:02
127 查看
%File Discription:
%45°和135°角边缘检测;用于那些边界不明显的图片
%不太适用于复杂图,复杂图用水平和垂直边缘检测
%Author:Zhang Ruiqing
%CreateTime:2011.8.8(What a good day!(*^__^*) )
SourcePic=imread('D:\Images\pic_loc\1870378220205041520.jpg');
subplot(221);
imshow(SourcePic),title('原图');
grayPic=rgb2gray(SourcePic);
grayPic=im2double(grayPic);
%使用指定45度角Sobel算子滤波器,指定阂值
a45=[-2 -1 0;-1 0 1;0 1 2];
SFST45=imfilter(grayPic,a45,'replicate');%功能:对任意类型数组或多维图像进行滤波。
SFST45=SFST45>=Threshold;
subplot(222);
imshow(SFST45),title('45度角图像边缘检测') ;
b45=[0 -1 -2;1 0 -1;2 1 0];
SFST45=imfilter(grayPic,b45,'replicate');%功能:对任意类型数组或多维图像进行滤波。
SFST45=SFST45>=Threshold;
SFST45
subplot(223);
imshow(SFST45),title('135度角图像边缘检测') ;
[html] view
plaincopy
%File Discription:
%水平、垂直边缘检测;
%Author:Zhang Ruiqing
%CreateTime:2011.8.8
SourcePic=imread('D:\毕业设计\Images\pic_loc\1870399350205061354.jpg');
subplot(221);
imshow(SourcePic),title('原图');
grayPic=rgb2gray(SourcePic);
grayPic=im2double(grayPic);
[Vertical Threshold]=edge(grayPic,'sobel','vertical');%edge detect
subplot(222);
imshow(Vertical),title('垂直方向边缘检测');
[Horizontal Threshold]=edge(grayPic,'sobel','horizontal');%edge detect
subplot(223);
imshow(Horizontal),title('水平方向边缘检测');
H_V=edge(grayPic,'sobel',Threshold);
subplot(224);
imshow(H_V),title('水平和垂直边缘检测');
%45°和135°角边缘检测;用于那些边界不明显的图片
%不太适用于复杂图,复杂图用水平和垂直边缘检测
%Author:Zhang Ruiqing
%CreateTime:2011.8.8(What a good day!(*^__^*) )
SourcePic=imread('D:\Images\pic_loc\1870378220205041520.jpg');
subplot(221);
imshow(SourcePic),title('原图');
grayPic=rgb2gray(SourcePic);
grayPic=im2double(grayPic);
%使用指定45度角Sobel算子滤波器,指定阂值
a45=[-2 -1 0;-1 0 1;0 1 2];
SFST45=imfilter(grayPic,a45,'replicate');%功能:对任意类型数组或多维图像进行滤波。
SFST45=SFST45>=Threshold;
subplot(222);
imshow(SFST45),title('45度角图像边缘检测') ;
b45=[0 -1 -2;1 0 -1;2 1 0];
SFST45=imfilter(grayPic,b45,'replicate');%功能:对任意类型数组或多维图像进行滤波。
SFST45=SFST45>=Threshold;
SFST45
subplot(223);
imshow(SFST45),title('135度角图像边缘检测') ;
[html] view
plaincopy
%File Discription:
%水平、垂直边缘检测;
%Author:Zhang Ruiqing
%CreateTime:2011.8.8
SourcePic=imread('D:\毕业设计\Images\pic_loc\1870399350205061354.jpg');
subplot(221);
imshow(SourcePic),title('原图');
grayPic=rgb2gray(SourcePic);
grayPic=im2double(grayPic);
[Vertical Threshold]=edge(grayPic,'sobel','vertical');%edge detect
subplot(222);
imshow(Vertical),title('垂直方向边缘检测');
[Horizontal Threshold]=edge(grayPic,'sobel','horizontal');%edge detect
subplot(223);
imshow(Horizontal),title('水平方向边缘检测');
H_V=edge(grayPic,'sobel',Threshold);
subplot(224);
imshow(H_V),title('水平和垂直边缘检测');
相关文章推荐
- Sobel算子实现水平边缘检测、垂直边缘检测;45度、135度角边缘检测
- 我的CUDA学习之旅4——Sobel算子图像边缘检测CUDA实现
- Sobel算子边缘检测(vc实现)
- Sobel算子边缘检测(vc实现)
- Sobel算子的边缘检测实现
- Sobel算子边缘检测Matlab实现(转)
- sobel算子实现边缘检测及其c++实现及与matlab效果对比
- 利用图像在水平和垂直方向上的差分运算对图像进行边缘检测
- CSS实现水平垂直居中方法总结
- CSS3实现水平垂直居中
- CSS3实现水平垂直居中(2)
- OpenCV边缘检测:Canny算子,Sobel算子,Laplace算子,Scharr滤波器合辑
- 常用图像边缘检测、增强MATLAB实现
- VC编程实现数字图像的边缘检测
- C#结合GDAL实现Roberts算子边缘检测
- CSS3 Flexbox轻巧实现元素的水平居中和垂直居中
- 基于MyBatis的数据库切分框架,可实现数据的水平切分和垂直切分。 http://www.makersoft.org
- css系列(布局):实现一个元素在浏览器中水平、垂直居中的几个方案
- Sobel算子(cvSobel)边缘检测
- VC编程实现数字图像的边缘检测