O'Reilly logo

Visual Media Processing Using MATLAB Beginner's Guide by George Siogkas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – warping frames using optical flow

Now that you have seen both the methods, it is time to try and reconstruct the first frame of the pair, using the second one and the optical flow field. We will try to accomplish that by a straightforward method called interpolation. This method actually tries to estimate unknown data, given a known set of data. In our case, the known set of data comprises the pixel values in the second frame of the pair and the motion vectors. We will repeat the same procedure for both the Horn-Schunck and Lucas-Kanade methods.

  1. We start by loading our video:
    >> clear all;
    >> videoObj = VideoReader('atrium.avi'); % Open video
  2. Now, we'll create two system objects, one for each optical flow method:
    >> ofHS = vision.OpticalFlow('ReferenceFrameDelay', ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required