Printable Version of Topic
Click here to view this topic in its original format
Unofficial VirtualDub Support Forums > Avisynth Filtering, Processing and Scripts Discussion > Overlay Of A Static Picture


Posted by: whugemann Oct 27 2004, 03:15 PM
I would like to superpose a video clip with a static picture that establishes a scale. (In fact, the video shows a the fall of a tachometer needle from 80 km/h to 0 km/h and I need a more precise scale than is on the tachometer.)

I extracted the first frame of that video, drew the scale and exported it (without the background) to a JPEG that shows the scale as black lines on white background.

I now would like to superpose the video with this scale and my first attempt is:

clip1=AviSource("C:\Tacho.avi").ConvertToRGB32()
clip2=ImageReader("C:\Scale.jpg",0,0,1,false).ConvertToRGB32().FlipVertical()
Overlay(clip1,clip3,mode="add",opacity=0.5)

The result is unsatisfactory, because the whole video is now lightend by the white background of the picture. How can I set the alpha channel such that white means transparent?

I made some attempts using mask and ColorMask, by did not succeed.

Posted by: whugemann Oct 27 2004, 08:51 PM
O.K., with lots of tries, I found out about it myself. The script must be changed to

clip1=AviSource("C:\Tacho.avi").ConvertToRGB32()
clip2=ImageReader("C:\Scale.jpg",0,0,1,false).ConvertToRGB32().FlipVertical()
clip3=clip2.Invert
Overlay(Clip1,Clip2,mask=Clip3)

If you read the description of the Overlay filter carefully, it says about the parameter "mask": "The darker the image is, the more transparent will the overlay image be."

As I drew black on white, I have to invert the image in order to get a reasonable mask!

Powered by Invision Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)