Image Recognition Methods
How filters work, with box blur and Gaussian blur as examples.
Box Blur is done by a Normal Unity Kernel Convolution. Unity meaning that
every element of the kernels matrix is 1. Normal meaning the pixels are then
averaged by dividing each by the absolute sum of all the pixels in the
Gaussian Blur uses a matrix where the edge values are 1, but the values closer
to the center follow a Normal distribution. A simple example might be:
https://www.youtube.com/watch?v=uihBwtPIBxM How the Sobel
edge detection filter works. Including finding the angle of the
edge.+ This provides both the edge, and the angle
of the edge. It uses Kernel Convolution with two matrixs, one applied to
find horizontal edge, and another for vertical.
These are then combined into a single result by squaring the value of each
pixel from the X result, adding that to the square of the corrisponding pixel
in the Y result, and then taking the square root of that. We can also take
each Y pixel and divide it by the X pixel then take the arc tangent of that
to find the angle of the edge at that point.
The Canny edge detection filter adds on to Sobel by thinning all the edges
to 1 pixel by looking for local maximum pixels along the direction of the
edge. It then removes weak edges via hysteresis thresholding. Two thresholds
are set, and edges above the top one are kept, edges blow the bottom are
removed, and edges between are kept if they are next to a kept edge.
(see the blog post) Given a greyscale image of dimisions m x n, the lighting
will often change from one part of the image to another. To pick out details
consistantly, you need to set the threshold individually for each pixel (i,j)
as the mean intensity of pixels in a w x w neighborhood around the pixel.
On each row, you might do
for i = 0 to N-1: s = 0; for k = max(i-r,0) to min(i+r,N-1): s +=
where w=2r+1. (r is half the width of the window). But it turns out that
this is faster:
Initialize s = sum(a..a[r]); for i = 1 to N-1: if i > r: s -= a[i-r-1];
if i < N-r: s += a[i+r]
at the end of each, s is the threshold for pixel a[i].
| ||©2023 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://techref.massmind.org/techref/datafile/images.htm"> Image Data</A>
Welcome to techref.massmind.org!