Computer Science Canada

[source] Edge Detection

Author:  Catalyst [ Fri May 30, 2003 3:24 pm ]
Post subject:  [source] Edge Detection

this is a little edge detection prog i made
lower edgeVal is , more edges show up

code:
%% Edge Detection

const edgeVal := 50


var pic : int := Pic.FileNew ("house.jpg")
View.Set ("nobuttonbar,graphics:" + intstr (Pic.Width (pic)) + ";" + intstr (Pic.Height (pic)))
var source, dest : array 1 ..maxx, 1 .. maxy of int
proc LoadBuffer (var x : array 1 .. *, 1 .. * of int)
    for i : 1 .. maxx
        for k : 1 .. maxy
            x (i, k) := whatdotcolor (i, k)
        end for
    end for
end LoadBuffer

proc DrawBuffer (var x : array 1 .. *, 1 .. * of int)
    for i : 2 .. maxx - 1
        for k : 2 .. maxy - 1
                drawdot (i, k, x (i, k))
        end for
    end for
end DrawBuffer



Pic.Draw (pic, 0, 0, picMerge)

LoadBuffer (source)


for i : 2 .. maxx - 1
    for j : 2 .. maxy - 1
        dest (i, j) := (source (i - 1, j - 1) + source (i - 1, j + 1) + source (i + 1, j - 1) + source (i + 1, j + 1)
            + 4.0 * (source (i - 1, j) + source (i, j - 1) + source (i, j + 1) + source (i + 1, j))
            - 20.0 * source (i, j)) div 6
        if dest (i, j) > edgeVal then
            dest (i, j) := 0
        else
            dest (i, j) := 7
        end if
    end for
end for


DrawBuffer (dest)

Author:  thoughtful [ Sun Nov 09, 2003 2:49 pm ]
Post subject: 

Hey very kool, i c you always have to come back at tony Twisted Evil Twisted Evil 8) .
I m wondering if n e one would make a motion blur filter Idea Idea

Author:  Tony [ Sun Nov 09, 2003 3:52 pm ]
Post subject: 

heh, Catalyst's post dates back to May 30, 2003 Laughing

But thx for the idea of motion blur Wink I've made it 8)


: