[cv]edge detection: gradients
来源:互联网 发布:php什么是面向对象 编辑:程序博客网 时间:2024/06/02 01:42
usually, filter is used to find a specific pattern in the pictures.
If we want to find lines and edges in the picture, firstly we think about gradients.
画图的时候,光画出线条就可以表达很多信息。
不要轻视线条,其中包含了太多的信息。
edges
线条的成因:
1. 物体表面的不连续,形状变化
2. 表面颜色不连续
3. 光照强度不连续
4. depth discontinuity,物体与背景的差异
detection edges
recall images as functions.
each location (x,y) has a value.
in the above picture, edges like the steep cliffs.
so, our basic idea: find a neighborhood with strong signs of change.
But, there are two problems:
1. neighborhood size
2. how to detect changes
derivative and edges
differential operator
image gradient
the gradient direction is given by :
The amount of change is given by the gradient magnitude:
finite difference
it was called right derivative.
differential operator
sobel operator
in matlab, there is a function imgradientxy which uses sobel operator but isn’t divided by 8.
So you need add a step to get that output divided by 8.
imgradientxy - Directional gradients of an image
This MATLAB function returns the directional gradients, Gx and Gy, the same size
as the input image I.
[Gx,Gy] = imgradientxy(I)
[Gx,Gy] = imgradientxy(I,method)
[gpuarrayGx,gpuarrayGy] = imgradientxy(gpuarrayI,_)
filter = fspecial('sobel'); % y directionres = imfilter(double(img), filter);imagesc(res);colormap gray;imshow(res);
imfilter function use correlation by default.
% Gradient Directionfunction result = select_gdir(gmag, gdir, mag_min, angle_low, angle_high) % TODO Find and return pixels that fall within the desired mag, angle range result = gmag>= mag_min & gdir >= angle_low & gdir <= angle_high;endfunctionpkg load image;%% Load and convert image to double type, range [0, 1] for convenienceimg = double(imread('octagon.png')) / 255.; imshow(img); % assumes [0, 1] range for double images%% Compute x, y gradients[gx gy] = imgradientxy(img, 'sobel'); % Note: gx, gy are not normalized%% Obtain gradient magnitude and direction[gmag gdir] = imgradient(gx, gy);imshow(gmag / (4 * sqrt(2))); % mag = sqrt(gx^2 + gy^2), so [0, (4 * sqrt(2))]imshow((gdir + 180.0) / 360.0); % angle in degrees [-180, 180]%% Find pixels with desired gradient directionmy_grad = select_gdir(gmag, gdir, 1, 30, 60); % 45 +/- 15imshow(my_grad); % NOTE: enable after you've implemented select_gdir
- [cv]edge detection: gradients
- [cv]edge detection: 2d operators
- [cv] Fourier Transform, Image Convolution, Edge Detection
- [cv] Image Convolution and Edge Detection (2nd)
- edge detection
- Canny Edge Detection Tutorial
- POJ 1009 Edge Detection
- poj 1009 Edge Detection
- Edge Detection: Sobel operator
- 1009 Edge Detection
- poj 1009 Edge Detection
- Sobel edge detection
- POJ 1009 Edge Detection
- POJ-1009-Edge Detection
- [POJ][1009]Edge Detection
- POJ 1008 Edge detection
- POJ 1009: Edge Detection
- POJ 1009 Edge Detection
- 如何修改Eclipse的 workspace目录
- c/c++整理--位运算与嵌入式编程(2)
- Maven的POM.xml详解(四)
- C#委托使用详解(Delegates)
- 算法竞赛入门经典(刘汝佳)习题3-8 UVa202
- [cv]edge detection: gradients
- 二分贪心练习题-X24
- 贝塞尔矫正
- 类 Date的简单了解
- Spring Cloud构建微服务架构(四)分布式配置中心(续)
- C++对象模型学习
- 从零开始学习SLAM
- turtle库
- 8个字符串处理函数