Thread: Transparent bmp on top of webcam feed?

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485

    Transparent bmp on top of webcam feed?

    Hallo,

    I am still working on my small program that displays a video feed (from a webcam) on the screen. Now I am done with all the main parts, but I would like to have a half transparent picture (which is loaded from a file every time a user presses a button - its a different picture every time) on top of the webcam feed. (or a half transparent webcam feed on top of a picture - both ways are fine)

    As of now I am having problems with getting that to work. First of all I am having problems drawing a half transparent bmp (24bit). I am also unsure on how to draw it so it stays on the screen "for ever". I tried using VW_PAINT, but that stops my webcam feed.

    Any ideas?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    OK, I found out how to draw a transparent picture on top of everything, but im not sure where to put the drawing code.

    No matter where I put it is just flickering. I assume this is because the webcam feed is trying to be on top?

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The only way you can draw something on top of something else in a "smooth" way is if you either:
    1. Combine both images off-screen.
    2. Use multilayer graphics solution, where there is a "keycolour" or "mask" to indicate which part shows which layer.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    Thanks for your reply.

    As I am still not fully understanding how windows programs work, I am not going to try to do this then.

    How does the webcam feed get updated? I know windows programs are event based, but I cant seem to find which event triggers the webcam update. The only part where I have "webcam code" is under WM_CREATE:

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by h3ro View Post
    Thanks for your reply.

    As I am still not fully understanding how windows programs work, I am not going to try to do this then.

    How does the webcam feed get updated? I know windows programs are event based, but I cant seem to find which event triggers the webcam update. The only part where I have "webcam code" is under WM_CREATE:
    Ehm, I have no idea how your web-cam code works, but I understand (to some extent) how a video player (such as Windows Media Player) works - when you set it up, a surface in the "overlay" is created, and a region of the screen is assigned a "key" to indicate which area of the screen should come from the video overlay and which should come from the normal display area. Webcam probably uses the same method, but I can't say for sure.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  2. Problem reading BMP
    By Mortissus in forum C Programming
    Replies: 4
    Last Post: 02-02-2006, 06:32 AM
  3. Transparent BMP display
    By Devil Panther in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2005, 06:35 AM
  4. Odd 3D Invis Objects?
    By Zeusbwr in forum Game Programming
    Replies: 4
    Last Post: 12-07-2004, 07:01 PM
  5. Stack functions as arrays instead of node pointers
    By sballew in forum C Programming
    Replies: 8
    Last Post: 12-04-2001, 11:13 AM