
-----------------------------------
Catalyst
Fri May 30, 2003 3:24 pm

[source] Edge Detection
-----------------------------------
this is a little edge detection prog i made
lower edgeVal is , more edges show up

%% 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)

-----------------------------------
thoughtful
Sun Nov 09, 2003 2:49 pm


-----------------------------------
Hey very kool, i c you always have to come back at tony  :twisted:  :twisted:  8) .
I m wondering if n e one would make a motion blur filter :idea:  :idea:

-----------------------------------
Tony
Sun Nov 09, 2003 3:52 pm


-----------------------------------
heh, Catalyst's post dates back to May 30, 2003 :lol:

But thx for the idea of motion blur :wink: [url=http://www.compsci.ca/v2/viewtopic.php?p=18609]I've made it 8)
