Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [source] Edge Detection
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Catalyst




PostPosted: 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)
Sponsor
Sponsor
Sponsor
sponsor
thoughtful




PostPosted: Sun Nov 09, 2003 2:49 pm   Post subject: (No 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
Tony




PostPosted: Sun Nov 09, 2003 3:52 pm   Post subject: (No 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)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: