wiki:videomorph

Version 2 (modified by bpt, 14 years ago) ( diff )

--

Morphing between 2 video sequences

Video morph resamples and blends two image sequences that have already been delineated / tracked e.g. using the tracker. Currently it does not work with video data at all, just collections of images e.g. jpeg files and their delineations (.tem files). The files to use for each sequence are specified in a text file with each line specifying an image and the corresponding tem file e.g.:

frame0.jpg frame0.tem

frame1.jpg frame1.tem

frame2.jpg frame2.tem

...

The user specifies matching frames in a separate text file. The first line in this file gives the time points in the first sequence (separated by whitespace) and the second line the corresponding frames in the second sequence e.g.

36 38 41 44 48 51 53 57 60 74 79 81 83 86 92 96 100 107 112 115 121

41 50 55 58 60 65 69 72 76 88 92 96 98 101 106 110 115 119 124 127 137

The output sequence is resampled in time as well as spatially. For example in the sequences given above in the first time interval the first set has 2 frames (i.e. 38-36) and the second set has 9 frames (i.e. 50-41) so the output set at a 0.5 blend will have 5.5 frames (i.e. (2+9)/2) and the image at frame 3 of the output will be at frame 2*3/5.5 = 1.09 in sequence 1 and 9*3/5.5 = 4.91 frames into sequence 2. The frames are sampled linearly so this would give a blend of:

output[3] = (sequence1[1]*0.91 + sequence1[2]*0.09)*0.5 + (sequence2[4]*0.09 + sequence2[5]*0.91)*0.5

The template is blended first and then the 4 images are warped into this shape and blended together (using the same weights) to produce the output frame.

Using the program

The following assumes you have already split your video into frames and have a .tem file for each frame. You will also need the two text files listing the frames and the text file with the matching frame information as specified above.

  1. Select File -> Start video morph from the File menu of the main Psychomorph window.
  2. Load the first set using "File->Open set 1".
  3. Load the second set using "File->Open set 2".
  4. Load the matching frame file using "File->Open time points". You should be able to scroll through the two sequences using the scroll bar at the bottom of the window and selecting the sequence using the options under view.
  5. When all the data is loaded correctly, click "File->Calculate morph". Go and have a coffee as this part is rather slow as it is using a non-linear software warping (hopefully this will be speeded up in later versions!).
  6. When it is finished you can view the warp using the option under view and the scroll bar.
  7. If you are happy select "File->Save As.." and give the name of the text file listing the image and template pairs.

Watch out - any images/templates in the output file with the same name will be overwritten without warning

Example data

Note: See TracWiki for help on using the wiki.