Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opencv/python: Draw image over a webcam stream [duplicate]

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!

like image 932
Cap.Alvez Avatar asked Aug 09 '26 18:08

Cap.Alvez


1 Answers

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.

like image 56
b_m Avatar answered Aug 12 '26 08:08

b_m



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!