View Single Post
Old 18th April 2011, 11:41   #2  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
It depends partly what you want to do the matching for. Are you just trying to get the correct frame from A matched up with the correct frame from B, i.e. synchronise them? Or are you trying to measure some specific aspect of how video A differs from video B? (In which case, you need to choose a process that reduces the extraneous factors such as noise, but doesn't destroy or distort the characteristic you want to measure.)

For solving the first problem, here are some ideas:

1. Run the two videos through a de-noise stage (same process and parameters for both) before comparing them.

2. If there are big differences in the noise characteristics of two sources, you could run the two videos through various different de-noising techniques (e.g. one spatial, one temporal; or spatial soften with two different sets of parameters (one subtle, one more aggressive); etc); then do cross-comparisons for each technique on video A against each technique on video B, and select whichever combination gives the closest matches.

3. Do something similar to what MVtools does for matching blocks, only applied to whole frames: Start by comparing really low-resolution versions of the two videos (e.g. 1/8th size), to get within a few frames of correct synch; then progressively improve the resolution (1/4 size, 1/2 size, full size) checking and refining the result as you go.

As for how you calculate the correct frame offset between the two videos, the process I think you need is:

1. Compare video, Frame N, against video B Frames N-2, N-1, N, and N+1, N+2 - i.e. for an offset of -2 to +2, find which is the closest match. Add that offset to a variable called "total_offset".
2. Repeat step one for the next frame, and the next... Keep a count of how many frames you've compared.
3. After some time (e.g. 10 frames), divide "total_offset" by the number of frames (use floating point), and round it to the nearest integer. If things are going well, this should equal the amount of adjustment you need to make to get the two videos in synch. If the video is fairly static, you may need to test over a longer sequence of frames.
pbristow is offline   Reply With Quote