OkanReg Class Reference

#include <OkanReg.h>

List of all members.

Public Member Functions

double norCrosCorr (int x0, int y0, int x1, int y1, int n, double mean0, double std0, double mean1, double std1)
void findHomography (int *ids, CvMat *h)
int checkHomographyQuality (CvMat *h, float errTol, float &mse)
 OkanReg ()
 ~OkanReg ()
void clearReg ()
void destroyImage (int id)
void setImage (IplImage *im, int id)
void setImage (string im, int id)
IplImage * getImage (int id)
void setImageROI (int id, int x1, int y1, int x2, int y2)
CvRect getImageROI (int id)
void removeImageROI (int id)
int getCornerSize (int id)
CvPoint2D32f * getCorner (int id)
void clearMatches ()
void addMatch (CvPoint2D32f p1, CvPoint2D32f p2)
void eraseMatch (int id)
vector< CvPoint2D32f > & getMatches (int id)
CvMat * getBestMat (int id)
int getBestPoint ()
float getBestMse ()
double findHarris (int id, int n, double thresh, double minDistance, int blockSize=3, int apertureSize=3, double k=0.04)
int findPutMatch (int n, int d=0, double thresh=-2)
bool findRANSACHomography (int iter, float errTol)

Public Attributes

IplImage * image [2]
IplImage * gray [2]
CvPoint2D32f * corner [2]
int cornerSize [2]
vector< CvPoint2D32f > matches [2]
CvMat * bestMat [2]
int bestPoint
float bestMse


Detailed Description

Image Registration class

Author:
Yunus OLGUN

Constructor & Destructor Documentation

OkanReg::OkanReg (  ) 

Constructor of OkanReg class. It simply makes all values 0 and all pointers NULL.

OkanReg::~OkanReg (  ) 

Destructor of OkanReg class. It releases all data it has. Be carefull about that, it does not releases image field of the class.

See also:
destroyImage()


Member Function Documentation

double OkanReg::norCrosCorr ( int  x0,
int  y0,
int  x1,
int  y1,
int  n,
double  mean0,
double  std0,
double  mean1,
double  std1 
)

Private member function to calculate normalized cross correlation of two points.

Parameters:
x0 x coordinate of first point
y0 y coordinate of first point
x1 x coordinate of second point
y1 y coordinate of second point
n window size for calculating mean and standard deviation of a corner
mean0 mean of first point
std0 standard deviation of first point
mean1 mean of second point
std1 standard deviation of second point
Returns:
normalized cross correlation of two points

void OkanReg::findHomography ( int *  ids,
CvMat *  h 
)

Finds homography matrix for one subset of putative matches.

Parameters:
ids It contains 4 integer which are indexes of putative matches
h A CvMat pointer to be filled by this function. It is used as return value.

int OkanReg::checkHomographyQuality ( CvMat *  h,
float  errTol,
float &  mse 
)

A private function to calculate quality of a homography matrix

Parameters:
h the homography matrix
errTol error tolerance while calculating quality of a homography matrix
mse mean square error of homography matrix. It is used as a return value
Returns:
quality of homography matrix

void OkanReg::clearReg (  ) 

It does same work of a destructor.

See also:
~OkanReg()

clearReg()

void OkanReg::destroyImage ( int  id  ) 

It releases all data of the image which has the id. It is used for destructor and clearReg also.

Parameters:
id id of image
See also:
~OkanReg()

~clearReg()

void OkanReg::setImage ( IplImage *  im,
int  id 
)

It sets im as a new image for registration process. It does not copy all image. It only copy the pointer. It releases all data for previous image named id. It calls destroyImage() for this process.

Parameters:
im pointer of new image
id the of image to be setted. It should 0 or 1
See also:
destroyImage()

void OkanReg::setImage ( string  im,
int  id 
)

Todo:
DO NOT USE THIS FUNCTION. While removing it do not forget to remove highgui.h from includes!!!

IplImage * OkanReg::getImage ( int  id  ) 

Get method of image field

Parameters:
id the id of the image which will be returned
Returns:
pointer to the this image

void OkanReg::setImageROI ( int  id,
int  x1,
int  y1,
int  x2,
int  y2 
)

sets region of interest for the image. Give a coordination of rectangle. Be carefull about that it affects every computation.

Parameters:
id image id
x1 x coordinate of top-left of rectangle
y1 y coordinate of top-left of rectangle
x2 width of rectangle
y2 heigth of rectangle

CvRect OkanReg::getImageROI ( int  id  ) 

Get method for region of interest of image

Parameters:
id image id
Returns:
CvRect which contains rectangle for region of interest

void OkanReg::removeImageROI ( int  id  ) 

Removes region of interest from image.

Parameters:
id image id

int OkanReg::getCornerSize ( int  id  ) 

Returns size of corners

Parameters:
id image id
Returns:
size of corners

CvPoint2D32f * OkanReg::getCorner ( int  id  ) 

Get method of corner field.

Parameters:
id image id
Returns:
return an array which contains corners.

void OkanReg::clearMatches (  ) 

Clears putative matches of two images. Because they are related with each other two of them will be removed at once.

void OkanReg::addMatch ( CvPoint2D32f  p1,
CvPoint2D32f  p2 
)

Adds a putative match to matches field.

Parameters:
p1 point for first image
p2 point for second image

void OkanReg::eraseMatch ( int  id  ) 

Removes the putative match from matches field.

Parameters:
id index of the putative match

vector< CvPoint2D32f > & OkanReg::getMatches ( int  id  ) 

Get method of images

Parameters:
id image id
Returns:
vector of putative matches

CvMat * OkanReg::getBestMat ( int  id  ) 

Get method of best homography matrix

Parameters:
id image id
Returns:
best homography matrix

int OkanReg::getBestPoint (  ) 

Returns the number of putative matches which correspond to best homography matrix

Returns:
the number of putative matches which correspond to best homography matrix

float OkanReg::getBestMse (  ) 

Returns mean square error of best homography matrix

Returns:
mean square error of best homography matrix

double OkanReg::findHarris ( int  id,
int  n,
double  thresh,
double  minDistance,
int  blockSize = 3,
int  apertureSize = 3,
double  k = 0.04 
)

Finds corners of the given image and pushes them into the corner field and sets cornerSize. ROI is effective at this.

Parameters:
id image id
n how many points should be found. If n is equal to 0, then thresh is ignored.
thresh quality level for determining weak corener points.
minDistance minimum distance between two corner points. According to this weaker ones will be eliminated from result.
blockSize block size of image. Default value is 3.
apertureSize aperture size for process. Default value is 3.
k a parameter for the corner detection algorithm. Default value is 0.04
Returns:
selected weakest corner's quality level

int OkanReg::findPutMatch ( int  n,
int  d = 0,
double  thresh = -2 
)

Finds putative matches of two images and pushes them into the matches field. If cornerSize is 0 it throws an exception. ROI is not effective

Parameters:
n window size for calculating mean and standard deviation of a corner.
d maximum distance between two corners to be a putative match.
thresh thresh value for eliminating weak putative matches.
Returns:
size of found putative matches

bool OkanReg::findRANSACHomography ( int  iter,
float  errTol 
)

Finds best homography matrix according to RANSAC algorithm. If size of 4-combinations is less than iter it tries every possible one. Otherwise it applies RANSAC algorithm

Parameters:
iter maximum number of iterations for RANSAC algorithm
errTol error tolerance for homography matrix. It is used in determining quality of homography matrix. If the difference between matches is smaller than this errTol variable, homography matrix's quality increases 1 point
Returns:
If successfull it return true, otherwise false


Member Data Documentation

IplImage* OkanReg::image[2]

Private IPLImage* array which keeps registered images.

IplImage* OkanReg::gray[2]

Private IPLImage* array which keeps gray level of registered images.

CvPoint2D32f* OkanReg::corner[2]

Private CVPoint2D32f* array which keeps corner points of two images.

int OkanReg::cornerSize[2]

Private int array which keeps size of corner points of two images.

vector< CvPoint2D32f > OkanReg::matches[2]

Private CvPoint2D32f vector which is used for putative matches of two images.

CvMat* OkanReg::bestMat[2]

Private CVMat* array which keeps best homography matrix of two images. bestMat[0] means image[0] * bestMat[0] => image[1]

int OkanReg::bestPoint

Private int which is used for estimating value of bestMat homography matrix. It means that how many of putative matches corresponds to best homography matrix.

float OkanReg::bestMse

Private float which is used for mean square error of best homography matrix


The documentation for this class was generated from the following files:
Generated on Sun Jun 15 22:35:25 2008 by  doxygen 1.5.3