View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vic Eldridge[_3_] Vic Eldridge[_3_] is offline
external usenet poster
 
Posts: 112
Default sobel filter with visual basic

How would I go about writing code in visual basic to do that for me

Everytime you select a cell on a worksheet, that worksheet's SelectionChange
event will fire. The SelectionChange event provides one argument called
Target, which represents the cell that was selected. You can use the Offset
method to examine the cells adjacent to the target cell.

how will it work for the cells on the very edge of the page, where there are no
cells next to them


There would be insufficient data to complete the calculation.


Regards,
Vic Eldridge



"l3xicon" wrote:


"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