We are trying to extract low-level information from images.
Why are we interested in edges?
Edges are image locations where things change, locations where significant events happen in certain images. Edges and corners are basic building blocks for many downstream computer vision applications.
We see something deluded in real edges, because there are both noisy and discrete images, that makes it not easy to precisely localize the edges. Below is a graph of real edges.
The edge operator should recover the edge position, tell the edge magnitude, and the edge orientation.
We want algorithms with high detection rates, good localization, and low noise sensitivity. Edges are image features that contain high frequencies.
The function value rapidly changes at an edge. We will try to find a mathematical operator, a derivative, that denotes the amount of change. The larger the amount of change, the higher the value of the derivative.
The magnitude of the derivative value is VERY high at an edge.
The height of the peak says how strong the edge is. The first edge detector compute the first derivative, take the absolute value, and the peaks are where the edges are.
In 2D, we have the location, strength, and orientation of the edges.
The gradient is represented by 2 partial derivatives (dl/dx, dl/dy), where these 2 derivatives are a 2D gradient vector.
The intensities of this algorithm are as follows below.
The following picture I am about to demonstrate is the Gradient as an edge detector.
Suppose there is a function f(x) and I want to compute the gradient of f(x) at a particular location, which is denoted by x. One way to do this is to look at a neighboring point and then the approximation tells us that the first derivative can be expressed as the difference in function values at the point and its neighbor. We can use this idea to compute the partial image derivatives for discrete images.
The horizontal gradient is the difference in pixel intensity value between the location values and its neighbors.
One issue is relying only on the noise of 2 pixels. The finite discrete gradient approximations are as follows. Filters can become easily represented as convolution.
As the filters become bigger, they become more robust to noise, but cannot detect/localize edges very precisely. Bigger filters are better to deal with noise, whereas smaller filters are better for precise edge localization.
The message is that we can compute the horizontal and vertical images through filtering.
The brighter a pixel, the stronger the delivery response. A strong horizontal edge is dI/dy and a strong vertical edge is dI/dX and the gradient magnitude is the combination of X and y derivaties.
We can then perform edge thresholding by using a simple edge derivative, or it can be Hysteresis based, using 2 thresholds. It uses spatial context for more robust decision-making.
||∇I(x,y)|| < T0 Definitely not an edge
||∇I(x,y)|| <= T1 Definitely an edge
T0<= |∇I(x,y)|| <= T1 Is edge if neighboring pixel is definitely an edge.
The following image is what edge pixels look like:
The first derivative is using gradient and thresholding. Unfortunately, there is a problem with this approach.
At the end of the method, you need to take a threshold (user-defined parameter) and all the pixel where the first derivative is higher than the threshold will be chosen as the derivative pixel. If the threshold is too small, it will get false positives, too high and nothing will be detected as a result.
We want to apply the operator to an image and find 0 crossings in a filtered image.
Applying the discrete Laplacian Operator can also be used as a convolution/correlation.
The following convolution masks are below.
Edge locations happen whenever the Laplacian Values Cross Zero, which is based on the second derivative.
The second derivative(and any derivative) = 0 when the second value is constant and not changing.
Edge locations is when there are rapid changes in intensity within a small region. Edges are image locations where interesting things happen
How do we deal with Noise?
One idea is to use the Fourier transform, but we are going to smooth this function with a low-pass Gaussian Filter.
We can blur some edges, but we have to do smarter smoothing. We have to do a bilateral filter, preserving edges while simultaneously removing the noise.
We can combine the gaussian and derivative in order to solve for the edge location. It looks like this:
We can do this with the Laplacian, the second derivative as well.
The Derivative of Laplacian and the Laplacian of the Gaussian look very different from each other.
The gradient provides for the strength and direction of the edge, whereas the Laplacian provides the location of the edge. The gradient works by thresholding, but Laplacian provides a more precise edge location, and finally the Gradient requires 2 convolutions to compute the magnitude, but the Laplacian is faster because it only requires 1 linear operation.
Can we develop an operator that has the best of both?
The answer is yes, and the solution is the Canny edge detector. The high level idea is to use both of the operators, the gradient for the direction and the Laplacian for the location of the edges
1. Smooth the image with the 2D Gaussian
nσ x I
2. Compute the image gradient using the Sobel Operator
∇nσ x I
3. Find the Gradient Magnitude at each Pixel
||∇nσ x I||
4. Find the Gradient orientation at each pixel.
∇nσ x I / ||∇nσ x I||
5.Compute laplacian at each direction.
∂^2(nσ x I)/(∂n)^2
6. Find zero crossings in Laplacian for edge location.
Do this for all locations, and find detected pixels.
The optimal amount of smoothing (σ) will determine the image, the tradeoff is that you might lose some of the edge pixels.
Moving on from edges is corners. Corners are where 2 edges meet. These are rapid changes of image brightness in 2 directions.
A corner region utilizes 2 strong gradient detections.
All the pixels in the flag region has low gradient values without much intensity change; therefore the gradient values correspond mostly around the origin. The gray plots are called Gradient Plots.
This is what the gradient looks for the Flat region, corner, and double edges, respectively.
The ellipse will be bigger and fatter in the corner images, with similar lengths for the major and minor axes.
If both axes λ1 and λ2 are large, this indicates that we likely have detected a corner.
To do this formally, we want a Harris corner response function, which equals λ1λ2 - k(λ1 + λ2) ^2
How o we idealize the pixel to one corner? The solution is called Non-Maximal Suppression
1. Slide a window of side k over the image.
At each position, keep the maximum pixel, otherwise, discard it (get it as negative).
Comments
Post a Comment