opencv/python: Draw image over a webcam stream


Question

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!

1
3
1/26/2013 6:38:38 PM

Accepted Answer

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.

1
5/23/2017 11:54:57 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon