3

Hey everyone I'm trying to make a game using my webcam where I need some objects to fall down the screen while Im streaming video with my webcam (that stream being my background).

The question is: how do I draw the image over this background? I know how to capture each frame and that I have to draw the image over the frames, but using what?

  • For this I am using python and opencv and the cv2 module.
  • Ive already searched and I discovered that you can use regions of interest to do that but I am using cv2 and it is said that using the numpy arrays that is much simpler.. but I dont understand how to do that..

Can anyone give me some tips or examples of how to do this?

Thanks in advance!

Cap.Alvez
  • 1,163
  • 2
  • 15
  • 19

1 Answers1

1

Here's an example. It shows how to overlay transparent images too. You can use the built in draw functions as well. There's a neat little trick to draw transparent shapes too.

Community
  • 1
  • 1
b_m
  • 1,393
  • 1
  • 16
  • 29
  • the first example worked but the second one that takes out the alpha channel didnt. Its giving me 'IndexError: invalid index' (Ive made copy paste of the code to make sure Im not making any mistake) – Cap.Alvez Jan 26 '13 at 22:22
  • @Cap.Alvez Did you figure out how to fix the second example – GuySoft Aug 06 '16 at 22:22