PDA

View Full Version : Superposition of Live Video and Bitmap Image



TimingMachinery
March 31, 2007, 02:03:09
Hi Stefan -


Since January 29 I have been enjoying great use in the classroom of the modified ScrollAndZoom example that you helped me achieve. At the risk of asking for things that a search of the forums would answer, I have new questions. How can my version of ScrollAndZoom be modified so that live video (a) has an adjustable transparency, and (b) is superimposed on a bitmap image (say, .gif) loaded from a specified file? The ability to take a snapshot of the live video image should be retained. (There is no requirement to record the video.) I ask the further question of how such a snapshot of the live video could temporarily replace the live video, so that the snapshot would be superimposed on the given bitmap image. Under that condition, I would want to be able to scale the snapshot larger or smaller, and make further adjustments on its transparency. Pointers to how I might achieve these functions would be greatly appreciated. I assume I better learn a lot more about filters.


Best regards,
Ellis

Stefan Geissler
April 2, 2007, 16:39:47
Hi Ellis,

First of all, IC Imaging Control does not support alpha blending. This means, you would have to do
this on your own. If you would use one of the IC .NET 2003 wizards, you could let the program
display the image processing result. The image in the wizard created code inverts the live video.
You would have to write the display of the live images on your own.

For loading an image are some functions in Visual Studio available. You would only need to copy the
bitmap on the OverlayBitmap object of the grabber. This is shown in the "Creating an Overlay"
sample.

At least creating transparence can be a time expensive task.

TimingMachinery
April 5, 2007, 00:15:47
Hi Stefan -

Thank you for your suggestions. Do you think the MediaLooks Video Mixer 1.1.2.1 could be adapted to use within my IC Imaging Control program? They claim "specify alpha (transparency) for each stream" and "images can be used as input streams." These certainly seem to be what I need, and they are selling their product as a DirectShow filter for real-time mixing of several video streams coming from different video sources such as cameras, files, or static images. I found them at

http://www.medialooks.com/products/directshow_filters/text_n_graphics_overlay.html

Ellis

Stefan Geissler
April 5, 2007, 10:00:39
Hi Ellis,

I am afraid you can not use this filter, because it is a DirectShow filter. IC does not have the capability to insert DirectShow filters.

I also can not see, whether this filter would solve your problem. The main task is to program the transparency, not to have an alpha channel in the video format. (BTW: RGB32 as sink format has an alpha channel, but this is set "traditionally" to zero).

To get a fast transparent image display using this RGB32 format, you would have to perform two main steps:
1.) Fill the alpha channel with the appropriate value
2.) Render the images in the membuffers
2.1) Do this on a DirectDraw surface with alpha blending

What do you want to display though the transparency of the live video? This should be displayed on a second DirectDraw surface too.

If you do not want to use DirectDraw, then you have to combine the membuffer of ICImaging Control and the background drawings on your own.

I am sure I created an alphablending frame filter last year, but I can not find it again. If I know, what you want to display with alpablending, then I can see, whether I can create a matching snippet.

TimingMachinery
April 5, 2007, 14:28:44
Hi Stefan -

Thanks again for your thoughts. I realize now that what I want to do MAY be easier if I change one thing. Instead of trying to make the live video transparent through which to see the static bitmap image, how about making the static bitmap image transparent through which to see the unchanged live video image? The objective is to see the superposition of two images, one static and one live, and to be able to capture a snapshot of the live image for subsequent merging with the static image.

Ellis

Stefan Geissler
April 5, 2007, 15:23:12
Hi Ellis,

At least, it is the same problem, but only vice versa. You must merge both images.