View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
l3xicon l3xicon is offline
external usenet poster
 
Posts: 1
Default sobel filter with visual basic


"Edge extraction algorithms work using a mathematical procedure called
convolution and commonly analyse derivatives (or second derivatives) of
the digital numbers over space. We will implement the Sobel method for
detecting edges, which is based on a 3 by 3 array that is moved over
the main image. This array is given by:
1 2 1
0 0 0
-1 -2 -1


Calculation proceeds as follows:
(1) We move the Sobel window over a particular pixel in the image;
(2) We calculate a new value for this pixel based on the sum of
products of the original image values and the values in the window.
i.e. consider the following section of an image:

90 85 72 71 65
95 87 76 73 69
98 88 80 78 76
100 93 83 80 75
101 96 76 77 72

If we place the Sobel filter at
The cell with a value of 88 we
see that the new digital number
for this cell is derived as follows:

95 × 1 87 × 2 76 × 1
98 × 0 88 × 0 80 × 0
100 × -1 93 × -2 83 × -1

=

95 174 76
0 0 0
-100 -186 -83



95 + 174 + 76 – 100 – 186 – 83 = -24

Therefore the new value for that cell would be -24."


How would I go about writing code in visual basic to do that for me in
a new sheet? I just don't know how to go about it. And how will it work
for the cells on the very edge of the page, where there are no cells
next to them, any ideas?


Sorry for the length, and please help.... I'm very very stuck.

Thanks,
l3xicon


--
l3xicon
------------------------------------------------------------------------
l3xicon's Profile: http://www.excelforum.com/member.php...o&userid=29522
View this thread: http://www.excelforum.com/showthread...hreadid=492209