Sobel operator

Started by
4 comments, last by Enigma 19 years, 4 months ago
i am writing a fingerprint recongition system in C# and want to know do any of ye have code for the sobel operator. i have tryed implementing it but really i dont know how to implement it. Any help would be greatly appriciated Thanks in advance Ructions
Advertisement
It's a simple convolution filter using this kernel.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
i understand that. So you center the mask over the pixel you want to manipulate. and you multiply each pixel with the correspond value in the mask. what you do then. is the mask just moved on to the next pixel and then the new values are multiplied again by the corresponding mask value. or am i gettin this entirely wrong


Please help
After you multiplied the mask with the pixels covered by the mask, you sum the values of all pixels masked and multipled and put the sum into the center pixel. This is repeated for all pixels in the image. Just note that you shouldn't modify the original image during the convolution, but the result shoud be stored in a second image (call it a temporary copy if you like).
but when you have them multiplied and add and the gradian is calcultae the values are very big. Do you do something like if the sum of all is greater then 1000 make the central pixel black and otherwise make it white. or am i getting it wrong
Also you must decide what to do on the boundary cases. The top left-hand corner pixel has no neighbours above or to the left. Possible options are:
Example Image:[00][01][02][03][04][05][06][07][08][09][10][11][12][13][14][15]

Here [nn] indicates pixel no. nn of the image.
  • Apply the Sobel operator only for the interior pixels. This leaves the output image 2 pixels smaller in both width and height.
    This results in the output image:
    [S05][S06][S09][S10]

    where [Snn] is the result of applying the Sobel operator to pixel nn of the input image.

  • As above, but pad the image back to original size by adding a single pixel black border.
    This results in the output image:
    [BBB][BBB][BBB][BBB][BBB][S05][S06][BBB][BBB][S09][S10][BBB][BBB][BBB][BBB][BBB]

    where [Snn] is the result of applying the Sobel operator to pixel nn of the input image and [BBB] is a black pixel.

  • Clamp the access at the edges, so if the operator references a pixel outside of the image it actually is clamped to reference the pixel at the edge of the image.
    This results in the output image:
    [C00][C01][C02][C03][C04][S05][S06][C07][C08][S09][S10][C11][C12][C13][C14][C15]

    where [Snn] is the result of applying the Sobel operator to pixel nn of the input image and [Cnn] is the result of applying a clamped Sobel operator to pixel nn of the input image. In this case [C01] would be the effect of applying the Sobel operator to the 3×3 block:
    [00][01][02] - line of clamped pixels[00][01][02][04][05][06]

  • Wrap the access to the opposite side of the image, so if the operator references a pixel outside of the image it actually is wrapped to reference a pixel on the opposite border of the image.
    This results in the output image:
    [W00][W01][W02][W03][W04][S05][S06][W07][W08][S09][S10][W11][W12][W13][W14][W15]

    where [Snn] is the result of applying the Sobel operator to pixel nn of the input image and [Wnn] is the result of applying a wrapped Sobel operator to pixel nn of the input image. In this case [W01] would be the effect of applying the Sobel operator to the 3×3 block:
    [12][13][14] - line of wrapped pixels[00][01][02][04][05][06]


Enigma

This topic is closed to new replies.

Advertisement