Search code examples
pythonopencvoverlaymaskingblending

How can i extract foreground mask from video and blend it onto background video?


I'm working on a basic video summarization project using static camera footage. I performed motion tracking by frame subtraction. Now I want to crop and overlay these objects on the background image such that it appear as if these objects are running simultaneously.

I could not find any resources except for this youtube video which is exactly what i want to do https://youtu.be/gk3qTMlcadk?t=140

any help will be appreciated.


Solution

  • You question is so broad!

    In short, use ‌background subtraction methods to separate background image from foregrounds. Then improve the foreground results using Morphology operations. Track foreground blobs in video. Merge foregrounds for each blob to create a mask image which shows the blob trajectory (trajectory image). Merge trajectory images with minimum overlap (complex issus!).