[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
Edge detection

(Graphics) Edge detection

Technique applied to images for detection of edges (that is steep color gradients).

It can be done by applying a filter operation to the image.

The filter typically has size 3x3 with the following values:

Vertical edge detection filter :
| -1 | -1 | -1 |
|  0 |  0 |  0 |
|  1 |  1 |  1 |
Horizontal edge detection filter :
| -1 |  0 |  1 |
| -1 |  0 |  1 |
| -1 |  0 |  1 |


Images can have different formats. In the rest of the example I use a grey image with grey values from 0 to 256, of which 0 denotes black and 255 denotes black.

When applying the horizontal edge detection filter to this image:

|  32 |  96 | 160 |
|  64 | 128 | 192 |
|  96 | 160 | 224 |


The central pixel of the resulting, 'filtered' image will have as a result:
(32 * -1) + ( 96 * 0) + (160 * 1) = 128
(64 * -1) + (128 * 0) + (192 * 1) = 128 
(96 * -1) + (160 * 0) + (224 * 1) = 128 +
------------------------------------------
                                    384


This value is beyond the range of the image's grey values.

This is correct: it must be transformed to fit this type of image format.

In this image format, the lowest possible result value is -765 (3 * -255). 765 is the highest possible result value.

The value 384 in this range [-765,765] must be transformed to the image's rang [0,255], which is done by the following formula:

           oldValue - minValue
newValue = ------------------- * 256
           maxValue - minValue


which transforms the value of 384 to 0.75 * 256 = 196

'Edge detection' links

  •  ?C++
  •  ?C++ VCL


last edited (March 20, 2007) by bilderbikkel, Number of views: 1751, Current Rev: 4 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.