Book Image

OpenCV Essentials

Book Image

OpenCV Essentials

Overview of this book

Table of Contents (15 chapters)
OpenCV Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Image alignment


OpenCV now implements the ECC algorithm, which is only available as of Version 3.0. This method estimates the geometric transformation (warp) between the input and template frames and returns the warped input frame, which must be close to the first template. The estimated transformation is the one that maximizes the correlation coefficient between the template and the warped input frame. In the OpenCV examples ([opencv_source_code]/samples/cpp/image_alignment.cpp), a related program can be found.

Note

The ECC algorithm is based on the ECC criterion of the paper Parametric Image Alignment Using Enhanced Correlation Coefficient Maximization. You can find this at http://xanthippi.ceid.upatras.gr/people/evangelidis/george_files/PAMI_2008.pdf.

We are now going to see an example (findCameraMovement) that uses this ECC technique using the findTransformECC() function:

#include <opencv2/opencv.hpp>

using namespace cv;
using namespace std;

int findCameraMovement()
{
    //1-Set...