Build a Filter from Kernel Weights
A metal surface has one unusually bright pixel among its neighbors.
Build a Filter from Kernel Weights explained visually
A metal surface has one unusually bright pixel among its neighbors. English captions are optional and start off. The complete transcript follows the written lesson.
What you will learn
A metal surface has one unusually bright pixel among its neighbors.
A practical question
One bright pixel appears on an otherwise smooth metal part. Should the new value depend on that pixel alone, or on its neighbors? A small filter kernel lets us combine nearby values. At each output location, we multiply the neighboring inputs by the kernel weights and add the results. The choice of weights determines what the filter does.
The useful idea
Take three neighboring values: ten, twenty, and thirty. Give them equal weights of one third, and the output is twenty. If every value in a region is the same and the weights sum to one, an averaging kernel preserves that constant interior region. Other weights can emphasize a direction or a change rather than smooth it.
Work through the example
Don't judge the kernel only in the middle of the picture. At the edge, some requested neighbors are outside the image. Negative intermediate results and output data types can matter for edge filters as well. Draw the small grid, show the weights, and calculate one output by hand before filtering thousands of parts.
Limits and next step
The bright speck might be noise, but a genuine tiny defect could look similar. Keep an unfiltered copy for review. Next, we'll decide what the kernel should do when part of its neighborhood is outside the frame.
Worked example
Average three values 10, 20, and 30 with equal weights to obtain 20.
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
A kernel assigns weights to nearby pixel values to compute each output. Weights and the output data type determine how edges and negative values behave.
What is the main idea behind build a filter from kernel weights?
A kernel assigns weights to nearby pixel values to compute each output.
How is it used in the example?
Average three values 10, 20, and 30 with equal weights to obtain 20.
What limitation should be checked?
Weights and the output data type determine how edges and negative values behave.
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 29 transcript204 words · Video transcript · Matches the published narration and captionsOpen transcript
One bright pixel appears on an otherwise smooth metal part. Should the new value depend on that pixel alone, or on its neighbors? A small filter kernel lets us combine nearby values. At each output location, we multiply the neighboring inputs by the kernel weights and add the results. The choice of weights determines what the filter does.
Take three neighboring values: ten, twenty, and thirty. Give them equal weights of one third, and the output is twenty. If every value in a region is the same and the weights sum to one, an averaging kernel preserves that constant interior region. Other weights can emphasize a direction or a change rather than smooth it.
Don't judge the kernel only in the middle of the picture. At the edge, some requested neighbors are outside the image. Negative intermediate results and output data types can matter for edge filters as well. Draw the small grid, show the weights, and calculate one output by hand before filtering thousands of parts.
The bright speck might be noise, but a genuine tiny defect could look similar. Keep an unfiltered copy for review. Next, we'll decide what the kernel should do when part of its neighborhood is outside the frame.