Hey! Thank you so much for the course. I’m learning a lot!
I’ve found a neat way of separating the background and the foreground from the Human Activity video with very little to no noise. When you horizontally stack the frames to form the video matrix, you get those horizontal lines with some noise right?
You can get a perfect background without the people by calculating the mode of each row, without using matrix decomposition at all in the process. This results in a mode vector (which you can reshape into an image). Then for each frame:
- background = mode vector
- foreground = frame vector – mode vector
Then reshape to get the images. There will be some noise in the foreground but you can change values close to 0 or close to 255 to 0.
Here is my result in the end:
I’ve also recreated the video using just the foreground frames so you can see people walking in empty space. Although I’m having difficulty generating exporting the frames from Python using MoviePy. Any ideas?
Code is here: https://github.com/smoussa/linear-algebra/tree/master
Video is here (download for better quality): https://drive.google.com/file/d/0B3q3JgN59rJhdXR2S1lfWU9XVDQ/view?usp=sharing