picture copying using draw dot
Author |
Message |
frank26080115
|
Posted: Sat Dec 02, 2006 1:49 am Post subject: picture copying using draw dot |
|
|
This program uses whatdotcolor to remember a colour and then draw it as a dot away, and 2 for loops makes it go through every pixel, it will create a really badly coloured copy of a picture
code: | var winID1 : int
%var winID2 : int
var picID : int
var abc : int := 4 % change me to change output resolution (1 is high res, 4 is low)
var colourabc : int
winID1 := Window.Open ("position:center;center,graphics:800;300")
loop
picID := Pic.FileNew ("test.jpg") % change file name
Pic.Draw (picID, 0, 0, picCopy)
for y1 : 1 .. 300 div abc by abc
for x1 : 1 .. 400 div abc by abc
colourabc := whatdotcolor (x1 * abc, y1 * abc)
Draw.Dot (x1 * abc + 400, y1 * abc, colourabc)
if abc > 1 then
Draw.FillOval (x1 * abc + 400, y1 * abc, abc, abc, colourabc)
end if
end for
end for
Pic.Free (picID)
delay (1000) % repeat intervals
end loop
|
a look at it working with a webcam taking pictures at 1 sec intervals (high res on top, low res on bottom):
http://www.spudfiles.com/uploader/uploadFiles/piccopyingprogram.jpg
I plan to use this for webcam motion tracking, because if i set "abc" to 4, and 4 pixels differ significantly from the original, then that means something is there that shouldn't be |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
zylum

|
Posted: Sat Dec 02, 2006 2:37 am Post subject: (No subject) |
|
|
if you want a faster method to compare 2 images, i suggest you look into the piccopy and picdraw methods. sure they may be deprecated but they have some handy features. for instance, the piccopy method stores the picture as a bitmap in an array. this way if you have your original image stored in the array and then you use piccopy to save your test image in an array, all you have to do is compare your two arrays. this method is much faster than using whatdotcolor plus id imagine it would be much easier to code. |
|
|
|
|
 |
frank26080115
|
Posted: Sun Dec 03, 2006 6:34 pm Post subject: (No subject) |
|
|
the point is to simplify the resolution and colours, that way a difference in image can be found easily
I'll work on using RGB values later, then I can use picdraw |
|
|
|
|
 |
|
|