+ Reply to Thread
Results 1 to 3 of 3

sobel filter with visual basic

  1. #1
    Registered User
    Join Date
    12-09-2005
    Posts
    2

    sobel filter with visual basic using loops

    "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
    Last edited by l3xicon; 12-10-2005 at 01:16 PM.

  2. #2
    Registered User
    Join Date
    12-09-2005
    Posts
    2
    bump, no one any ideas?

  3. #3
    Vic Eldridge
    Guest

    RE: 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
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1