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.
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?
Mine would not work if the background is moving at all. Matrix decomposition is definitely needed here. I’ve used the mode to get the background and SVD to get the foreground.
Thanks for sharing the link, I’ve used it to create my final video. Apparently the ‘t’ argument is a float, not an integer index to be used to get a frame. It’s working now!
Hey. I too tried using Mode and was going to post about it when I found, of course, this had already been done.
However, I used the background removal to create a mask over the original video to maintain the original colours. Then put Original, Mode, SVD and PCA together in a video: https://youtu.be/f2-dAuSNIfE