Reputation: 4350
We have a video file from a security camera. There is a reflective object that reflects some image data but this is not clear. If we look very carefully to that reflective object, we can understand what is going on outside of that camera. Do we have a chance to substract a default scene screenshot image from every frame of the rest of the video file? That would give us the reflected objects movements' video more clearly.
This picture shows what I need:
They call this Video-Based Change Detection
Upvotes: 0
Views: 2908
Reputation: 402
I can suggest scenedetect 1, a nice and updated python software
From the website, for the lazy ones
PySceneDetect is a command-line application and a Python library for detecting scene changes in videos, and automatically splitting the video into separate clips. Not only is it free and open-source software (FOSS), but there are several detection methods available (see Features), from simple threshold-based fade in/out detection, to advanced content aware fast-cut detection of each shot.
PySceneDetect can be used on its own as a stand-alone executable, with other applications as part of a video processing pipeline, or integrated directly into other programs/scripts via the Python API. PySceneDetect is written in Python, and requires the OpenCV and Numpy software libraries.
Examples and Use Cases Here are some of the things people are using PySceneDetect for:
splitting home videos or other source footage into individual scenes automated detection and removal of commercials from PVR-saved video sources processing and splitting surveillance camera footage statistical analysis of videos to find suitable "loops" for looping GIFs/cinemagraphs academic analysis of film and video (e.g. finding mean shot length)
Upvotes: 1
Reputation: 4350
This dirty shell code got things done:
#!/bin/bash
#
# READ: http://www.imagemagick.org/Usage/compare/#difference
#mkdir orig-images diff-images
fps=6
## create png files
#ffmpeg -i orig.avi -r $fps -f image2 orig-images/image-%07d.png
cd orig-images
# get first image as default scene
for i in $(ls image-*.png); do
default_image=$i
break
done
# or set default scene manually
default_image="image-0003631.png"
rm ../diff-images/*
for i in $(ls image-*.png); do
echo "processing: $i"
#compare $default_image $i -compose src "../diff-images/diff-$i"
convert $i $default_image -compose difference -composite \
-evaluate Pow 2 -separate -evaluate-sequence Add -evaluate Pow 0.5 \
"../diff-images/diff-$i"
done
cd ..
cd diff-images
## create movie from png files
rm ../out.mov
ffmpeg -r $fps -start_number 3529 -i diff-image-%07d.png ../out.mov
Upvotes: 1