Reputation: 300
I have been looking for algorithms related to video change detection.
Basically it will see if there is any visual difference in the current frame wrt to previous frame or the first frame of the video and show use the difference.
Can you please suggest an algorithm?
My implementation: I did read video frame by frame and converted to gray scale subtracted each frame with first frame and played the video(current frame-first frame)
Upvotes: 0
Views: 5794
Reputation: 54
Computing Chi-Square distance of RGB histograms of adjacent frames is one of the robust methods. You can see the implementation and usage of this method in here.
Upvotes: 0
Reputation: 6246
Here is a way you can test whether there is similarity between two image : -
- Divide two image into 4*4 or 8*8 blocks
- Take squared error from difference of two corresponding blocks from both images
- Accumulate the errors and check it against the threshold
- if less than threshold then they are similar images
- else different
Another way to do it : -
As we know two similar frames can have bit of translation in them : -
Use Cross-Correlation of the two images, higher it is the more related the images are.
Upvotes: 2
Reputation: 50667
You can try the following two approaches:
Compute difference on the Mat data directly (code using OpenCV):
cv::Mat diff;
cv::absdiff(imgA, imgB, diff);
Compute difference on the feature vectors of two images. For example, you can first compute RGB/HSV color histogram (24d vector if use 8-bins for each channel) for each image and then compute correlation of these two histogram vectors.
Upvotes: 0
Reputation: 3274
Have you tried getting any result by computing the histograms and comparing them to one another (with EMD for instance) ?
A big change in the video would show up as a big change in the histogram would
I recall reading a paper where the authors would detect scenes cut by detecting a big jump in the histogram.
EDIT: This is not what I had in mind, but it looks good. This paper presents several techniques and their relative performance John S. Boreczky and Lawrence A. Rowe, « Comparison of video shot boundary detection techniques », Storage and Retrieval for Image and Video Databases (SPIE), 1996.
Upvotes: 1
Reputation: 2366
Here is an example for scene change detection based on edge detection using MATLAB's Computer Vision System toolbox.
Upvotes: 0