Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the relationship between image edges and gradient?

Is there anybody can help me interpret "Edge points may be located by the maxima of the module of the gradient, and the direction of edge contour is orthogonal to the direction of the gradient."

like image 729
Gary Gauh Avatar asked Jan 12 '12 14:01

Gary Gauh


People also ask

What is the relation between the edge and the gradient directions?

The "true" edge point is the point at which slope is steepest along the gradient corresponding to the edge of an object. The gradient will be steepest when it is perpendicular to the edge of the object.

How can you detect edges with gradient filters?

Vertical edges can be detected by using a horizontal gradient operator followed by a threshold operation to detect the extreme values of the gradient. The gradient produces a doublet of extremes, positive-negative or negative-positive, depending on the direction of the transition.

What is gradient based edge detection?

The edge detection operation is essentially an operation to. detect significant local changes in the intensity level in an. image. The change in intensity level is measured by the. gradient of the image.

How do you interpret an image gradient?

Thus in simple words, image gradient in x-direction measures the horizontal change in intensity while the gradient in y measures the vertical change in intensity. Since edges are an abrupt change in the intensity values thus the largest gradient values will occur across an edge (neglecting noise) in an image.


2 Answers

Paul R has given you an answer, so I'll just add some images to help make the point.

In image processing, when we refer to a "gradient" we usually mean the change in brightness over a series of pixels. You can create gradient images using software such as GIMP or Photoshop.

Here's an example of a linear gradient from black (left) to white (right):

linear gradient

The gradient is "linear" meaning that the change in intensity is directly proportional to the distance between pixels. This particular gradient is smooth, and we wouldn't say there is an "edge" in this image.

If we plot the brightness of the gradient vs. X-position (left to right), we get a plot that looks like this:

plot of linear gradient

Here's an example of an object on a background. The edges are a bit fuzzy, but this is common in images of real objects. The pixel brightness does not change from black to white from one pixel to the next: there is a gradient that includes shades of gray. This is not obvious since you typically have to zoom into a photo to see the fuzzy edge.

black box on white background

In image processing we can find those edges by looking at sharp transitions (sharp gradients) from one brightness to another. If we zoom into the upper left corner of that box, we can see that there is a transition from white to black over just a few pixels. This transition is a gradient, too. The difference is that the gradient is located between two regions of constant color: white on the left, black on the right.

zoomed corner of box

The red arrow shows the direction of the gradient from background to foreground: pixels are light on the left, and as we move in the +x direction the pixels become darker. If we plot the brightness sampled along the arrow, we'll get something like the following plot, with red squares representing the brightness for a specific pixel. The change isn't linear, but instead will look like one side of a bell curve:

plot of edge

The blue line segment is a rough approximation of the slope of the curve at its steepest. The "true" edge point is the point at which slope is steepest along the gradient corresponding to the edge of an object.

Gradient magnitude and direction can be calculated using horizontal and vertical Sobel filters. You can then calculate the direction of the gradient as:

gradientAngle = arctan(gradientY / gradientX)

The gradient will be steepest when it is perpendicular to the edge of the object.

If you look at some black and white images of real scenes, you can zoom in, look at individual pixel values, and develop a good sense of how these principles apply.

like image 156
Rethunk Avatar answered Sep 20 '22 16:09

Rethunk


Object edges typically result in a step change in intensity. So if you take the derivative of intensity it will have a large (positive or negative) value at edges and a smaller value elsewhere. If you can identify the direction of steepest gradient then this will be at right angles to (orthogonal to) the object edge.

like image 32
Paul R Avatar answered Sep 19 '22 16:09

Paul R