边缘检测VS梯度图像
2008-08-08 10:43
204 查看
图像的边缘检测可以通过梯度算子来实现,诸如,Roberts,sobel,prewitt,canny等,它的本质也就是对一幅图像求其梯度图像,那么在matlab中通过edge函数求得的边缘和我们直接使用梯度算子求得一幅图像的梯度图像会不会有区别呢?在matlab环境下,通过这样一个实验来看一下结果:
Step1: read an image into workspace.
rgb = imread(pears.png);
imshow(rgb);
I = rgb2gray(rgb);
figure,imshow(I)
step2:Detect the edge of the gray image,I,using edge() function.Here we use 'Sobel' as the parameter.
BW = edge(I,'sobel');
figure,imshow(BW),title('sobel edge detection')
step3:Now we calculate the gradient of the image through sobel method.
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I),hy,'replicate');
Ix = imfilter(double(I),hx,'replicate');
gradmag = sqrt(Ix.^2+Iy.^2);
figure,imshow(gradmag,[]),title('gradmag')
OK,so now,have u found what's the difference?
很明显的一点是:edge()函数的输出为二值图像,而我们计算所的梯度图像仍为灰度图像。
Step1: read an image into workspace.
rgb = imread(pears.png);
imshow(rgb);
I = rgb2gray(rgb);
figure,imshow(I)
step2:Detect the edge of the gray image,I,using edge() function.Here we use 'Sobel' as the parameter.
BW = edge(I,'sobel');
figure,imshow(BW),title('sobel edge detection')
step3:Now we calculate the gradient of the image through sobel method.
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I),hy,'replicate');
Ix = imfilter(double(I),hx,'replicate');
gradmag = sqrt(Ix.^2+Iy.^2);
figure,imshow(gradmag,[]),title('gradmag')
OK,so now,have u found what's the difference?
很明显的一点是:edge()函数的输出为二值图像,而我们计算所的梯度图像仍为灰度图像。
相关文章推荐
- 图像梯度特征的常用边缘检测算子:Sobel、Prewitt、Roberts
- 数学中的梯度在图像边缘检测中的应用
- Python语言opencv使用笔记(七)(图像梯度与边缘检测)
- Python下opencv使用笔记(七)(图像梯度与边缘检测)
- Python+OpenCV学习(4)---图像梯度及边缘检测
- 图像处理--------应用卷积– 轧花与边缘检测
- 【数字图像处理】Canny边缘检测详解及编程实现
- 图像处理(九)边缘检测(一)
- 图像边缘检测--OpenCV之cvCanny函数
- 图像边缘检测综述
- 图像处理常用边缘检测算子总结
- 图像边缘检测经典算子及MATLAB实现
- 图像处理25:边缘检测
- 图像边缘检测——几种图像边缘检测算子的学习及python 实现
- 图像边缘检测原理&何谓角点及Harris角点的基本原理&SURF特征提取简介
- 数字图像处理15--互相关匹配边缘检测
- 图像边缘检测算法源程序
- 计算图像的拉普拉斯变换,使用方向滤波器检测边缘
- 图像处理常用算法GPU实现三:基于模板匹配的边缘检测
- 【学习opencv】对图像缩放并进行边缘检测