From Gradient Map to Thin Edges
A thick gradient band covers several pixels beside a sharp boundary.
From Gradient Map to Thin Edges explained visually
A thick gradient band covers several pixels beside a sharp boundary. English captions are optional and start off. The complete transcript follows the written lesson.
What you will learn
A thick gradient band covers several pixels beside a sharp boundary.
A practical question
A single border on the metal part appears as a thick, glowing stripe in our gradient map. We don't want to label every pixel in that stripe as a separate boundary. We want the strongest point across it. That's the purpose of nonmaximum suppression.
The useful idea
At each candidate location, look along the direction in which the image changes most rapidly. Compare the candidate's gradient strength with nearby strengths on either side. Keep a local peak and suppress weaker neighbors. This can turn a broad ridge of gradient responses into a much thinner edge. The comparison needs the gradient direction; looking only left and right would mishandle a diagonal border.
Work through the example
Try the operation on a clean straight edge and then on a scratched, textured surface. The clean edge may thin nicely. Texture may leave many narrow responses that are not defects. Thinning tells us where a local change peaks; it doesn't decide whether the change matters to the inspection.
Limits and next step
Keep the original and the gradient map beside the thinned result. If a useful faint line has disappeared, investigate its gradient and the smoothing that came before it. Next, we'll use linked thresholds to decide which weak edge segments deserve to stay.
Worked example
Thin a wide response before treating it as a final edge map.
Quick check: test your understanding
Try it yourself: In the situation described above, explain the method and one reason its output might be misleading.
Check the reasoning
Nonmaximum suppression keeps a local peak along the gradient direction. Thin edges still require sensible thresholds and noise handling.
What is the main idea behind from gradient map to thin edges?
Nonmaximum suppression keeps a local peak along the gradient direction.
How is it used in the example?
Thin a wide response before treating it as a final edge map.
What limitation should be checked?
Thin edges still require sensible thresholds and noise handling.
Further reading
Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 34 transcript199 words · Video transcript · Matches the published narration and captionsOpen transcript
A single border on the metal part appears as a thick, glowing stripe in our gradient map. We don't want to label every pixel in that stripe as a separate boundary. We want the strongest point across it. That's the purpose of nonmaximum suppression.
At each candidate location, look along the direction in which the image changes most rapidly. Compare the candidate's gradient strength with nearby strengths on either side. Keep a local peak and suppress weaker neighbors. This can turn a broad ridge of gradient responses into a much thinner edge. The comparison needs the gradient direction; looking only left and right would mishandle a diagonal border.
Try the operation on a clean straight edge and then on a scratched, textured surface. The clean edge may thin nicely. Texture may leave many narrow responses that are not defects. Thinning tells us where a local change peaks; it doesn't decide whether the change matters to the inspection.
Keep the original and the gradient map beside the thinned result. If a useful faint line has disappeared, investigate its gradient and the smoothing that came before it. Next, we'll use linked thresholds to decide which weak edge segments deserve to stay.