View Full Version : applying filters to pixel positions
kingmob
6th January 2005, 14:10
In order to help my girlfriend with a presentation for a building she is designing, i've taken it upon me to make for her the video she needs.
It basicly comes down to rendered pictures of the building (a hotel) with a map beneath it. On this map, a small dot or whatever, has to move from position to position, marking what people are seeing on the map. This dot has to move.
Now i don't know any editors with which i could just do this, so i thought i'd just make a simple filter with avisynth. But, before i can encounter any problem at all, the first thing i need to know is how i can overlay a small dot on a precise position. Since i thought this would basicly come down to putting a hole in a binary mask in masktools, i named the topic the way i did.
All help is welcome.
kingmob
6th January 2005, 15:18
Ok, i shouldn't post questions too fast, i know :p. Anyway, i have been able to produce a dot through the 'layer' function. I'll go and strugle with getting it to move now :).
Wilbert
6th January 2005, 15:25
You should put the dot (or 2x2 pixel dot for YUV) on a black background, put a mask on it. Use animate/overlay to move it over the background clip ...
kingmob
6th January 2005, 16:27
Thanks for the animate tip, that seems to work for it in principle. Since i'm gonna use several renders, i want to minimize the typing work. Therefore i'm trying to put animate into my seperate function, so i can input everything at once. Otherwise i'd have to use two lines for one render, which is not a real problem, i just want to get this one to work :P.
This is the function i use:
Function DotWalk(clip c, int startposx, int startposy, int endposx, int endposy, int startnum, int endnum)
{
dot = ImageSource(file = "dot.bmp", fps = 25, use_DevIL = False)
vid = Animate(c, startnum, endnum, "Layer", last,dot,"add",225,startposx,\
startposy, last,dot,"add",225,endposx,endposy)
video = Trim(vid,startnum,endnum)
return video
}
And i call it like this:
Import("DotWalk.avs")
ConvertToRGB32(AviSource("test.avi")).Trim(0,-400)
DotWalk(100,100,200,200,100,299)
Using this, avisynth gives me the following error message: animate: Must have to argument lists with matching types.
I think animate is probably having a hard time knowing what's what, but i cannot name the arguments like one would normally...
Wilbert
6th January 2005, 17:57
Try something like
Function DotWalk(clip c, int startposx, int startposy, int endposx, int endposy, int startnum, int endnum)
{
dot = ImageSource(file = "dot.bmp", fps = 25, use_DevIL = False)
vid = Animate(startnum, endnum, "Layer", c, dot, "add", 225, startposx, startposy,
\ c, dot, "add", 225, endposx, endposy)
Trim(vid,startnum,endnum)
}
sh0dan
8th January 2005, 13:55
Actually I think the conditional functions in Overlay could help here.
Script:
a1 = VIDEO
a2 = DOT
overlay(a1,a2, y = 0, x = 0)
ConditionalReader("xoffset.txt", "ol_x_offset", false)
ConditionalReader("yoffset.txt", "ol_y_offset", false)
xoffset.txt:
Type int
Default -50
R 0 100 150
I 100 200 150 250
R 200 300 250
I 300 400 250 120
yoffset.txt:
Type int
Default -50
R 0 100 50
I 100 200 50 150
R 200 300 150
I 300 400 250 120
This will display the dot at (150,50) the first 100 frames, move it to position (250, 150) over 100 frames, leave it there for 100 frames and move it to (120,120).
This allows you to create several animations in one go, and allow you to place the overlay outside the frame (-50,-50) as default values.
kingmob
9th January 2005, 13:00
That looks nice and flexible Sh0dan, gonna try it out :).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.