Rapid changes in image intensity in small window caused by:
- Position
- Magnitude
- Orientation
The x-coordinate is defined here as increasing in the "right"-direction, and the y-coordinate is defined as increasing in the "down"-direction.
First derivative edge detection provides both location and strength
The simplest approach is to use central differences:
while the gradient orientation can be estimated as:
-
good localization
-
noise sensitive
Gradient of an image through discrete differentiation which is achieved by computing the sum of the squares of the differences between diagonally adjacent pixels.
we convolve the original image, with the following two kernels:
Let
be a point in the original image and
be a point in an image formed by convolving with the first kernel and
be a point in an image formed by convolving with the second kernel. The gradient can then be defined as:
direction of the gradient:
where here denotes the 2-dimensional convolution operation.
Prewitt it is a separable filter (can be decomposed as the products of an averaging and a differentiation kernel), therefore can be written as:
Sobel is a separable filter (can be decomposed as the products of an averaging and a differentiation kernel), therefore
Refs: 1
differential approach of detecting zero-crossings
Second-order derivatives can be computed from the scale space representation according to:
corresponding to the following filter masks:
- Edges are zero crossing in Laplacian image
- Laplacian doesn't provide direction of edges
Convolution Properties: Associativity
First derivative is linear operation, Gaussian smoothing is also linear operation so we can find the first derivative of Gaussian
A 2-dimensional convolution operation is separated into two 1-dimensional filters.
This reduces the computational costs on an image with a
Examples:
- Smoothing filter:
- Weighted smoothing filter:
- Sobel operator:
Filtering often involves replacing the value of a pixel in the input image F with the weighted sum of its neighbors
convolution of 5×5 sized image matrix x
with the kernel h
of size 3×3,
kernel flipping and mirroring:
sliding the kernel over the image:
- The function does actually compute correlation, not the convolution
- That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using flip and set the new anchor to
(kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1)
. - The function uses the DFT-based algorithm in case of sufficiently large kernels (~11 x 11 or larger) and the direct algorithm for small kernels.
void filter2D(Mat src,
Mat dst,
int ddepth,
Mat kernel,
Point anchor,
double delta,
int borderType);
Refs: 1