Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Overlay Of A Static Picture, Problems setting the alpha channel
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
whugemann
Posted: Oct 27 2004, 03:15 PM


Unregistered









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.
 
  Top
whugemann
Posted: Oct 27 2004, 08:51 PM


Unregistered









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!
 
  Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
1 replies since Oct 27 2004, 03:15 PM Track this topic | Email this topic | Print this topic

<< Back to Avisynth Filtering, Processing and Scripts Discussion