The concept of image edge is frequently used in image processing projects. edge detection is an important step for further identification.
This article is a reply from a enthusiastic person when I went to stackoverflow to ask about the relationship between the border and derivative of a foreigner's image.
I have been busy recently. I don't have time to translate it. I will first release the original article for your appreciation.
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 ):
The gradient is "linear" meaning that the change in intensity is directly proportional to the distance between pixels. this particle 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:
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 des shades
Of gray. This is not obvious since you typically have to zoom into a photo see the fuzzy edge.
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.
The red arrow shows the ction 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:
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 magnimaging and direction can be calculated using horizontal and vertical Sobel filters. You can then calculate the direction of the gradient:
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.
Repost this article please indicate the author and the source [Gary's influence] http://garyelephant.me, do not for any commercial purposes!
Author: Gary Gao focuses on the internet, distributed, high concurrency, automation, and software teams