Python & PIL
I had planned to do the computer vision aspect of this project with python-opencv (The python hooks into the Open Computer Vision library). I ended up abadoning this method because OpenCV does not have any simple tracking (center of gravity of moved pixels in the frame) only complex tracking. I looked at CAMShift and MHI algorithms. The CAMShift tracking the colour mean of an image, MHI is a motion history image that calculates vectors of motion in the image based on a gradient from old to new frames. Both these methods (and opencv in general) work best with static cameras, so these methods get total lost when there is a scene cut.
In order to get data more quickly after a month of work on opencv I decided to look at the Python Imaging Library (PIL) which gives you a nice number of functions for working with image files. This is not a real-time image processing library, though it is quite fast considering. PIL has not computer vision facilities built in. I ended up doing a very simple process where the program:
- Opens an image file.
- Opens the previous file in the sequence.
- Removes the colour data from the images
- Subtracts the two frames to get the difference
- Writes the mean value of the pixels in the image to a logfile.
I wrote two python programs for:
- Controlling ffmpeg to batch process the ripped VOB fiels into jpgs Media:Example.ogg
- Image Processing Media:Example.ogg