$search

calibration.hpp File Reference

Declarations for generic geometric calibration. More...

#include "improc.hpp"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <getopt.h>
#include <iostream>
#include <fstream>
#include <sys/stat.h>
#include <dirent.h>
#include <sstream>
#include <string>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <errno.h>
#include <malloc.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <limits.h>
#include <termios.h>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/gpu/gpu.hpp"
#include <opencv2/video/video.hpp>
Include dependency graph for calibration.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mserPatch
 Class enables for storing an MSER feature beyond simply its bounding points. More...

Defines

#define ALL_PATTERNS_OPTIMIZATION_CODE   0
#define BEST_OF_RANDOM_PATTERNS_OPTIMIZATION_CODE   4
#define CHESSBOARD_FINDER_CODE   0
#define DEBUG_MODE   0
#define ENHANCED_MCM_OPTIMIZATION_CODE   3
#define EXHAUSTIVE_SEARCH_OPTIMIZATION_CODE   5
#define EXTENDED_CHESSBOARD_FINDER   5
#define FIRST_N_PATTERNS_OPTIMIZATION_CODE   2
#define FOLD_COUNT   1
#define HEATED_CHESSBOARD_FINDER_CODE   2
#define INVERTED_OPENCV_CHESSBOARD_FINDER   10
#define MASK_FINDER   3
#define MASK_FINDER_CODE   1
#define MASK_FINDER_INNERS   8
#define MAX_CAMS   3
#define MAX_CANDIDATE_PATTERNS   100
#define MAX_FRAMES_PER_INPUT   5000
#define MAX_FRAMES_TO_LOAD   1000
#define MAX_PATTERNS_PER_SET   10
#define MAX_PATTERNS_TO_KEEP   500
#define MAX_SEARCH_DIST   3
#define MIN_DISTANCE_FROM_EDGE   2
#define PATCH_CORRECTION_INTRINSICS_FLAGS   CV_CALIB_RATIONAL_MODEL
#define PATTERN_FINDER_CV_CORNER_SUBPIX_FLAG   4
#define PI   3.14159265
#define RADIAL_LENGTH   1000
#define RANDOM_SEED_OPTIMIZATION_CODE   6
#define RANDOM_SET_OPTIMIZATION_CODE   1
#define REGULAR_OPENCV_CHESSBOARD_FINDER   0
#define SCORE_BASED_OPTIMIZATION_CODE   7
#define TRACKING   0

Functions

void addToBinMap (Mat &binMap, cv::vector< Point2f > &cornerSet, Size imSize)
 Add a cornerset to the tally matrix.
void addToDistributionMap (Mat &distributionMap, vector< Point2f > &corners)
 Measures the coverage of a cameras field of view by analysing the distribution tally.
void addToRadialDistribution (double *radialDistribution, cv::vector< Point2f > &cornerSet, Size imSize)
 Adds a pointset to a radial distribution array.
bool checkAcutance ()
 Checks validity of image for calibration.
void clusterFilter (vector< mserPatch > &patches, vector< vector< Point > > &msers, int totalPatches)
 Filters out MSERs that cannot possibly be part of the geometric pattern.
bool correctPatchCentres (const Mat &image, Size patternSize, vector< Point2f > &patchCentres, int mode)
 Uses contrast enhancement etc to improve positional estimates of patch centres.
void debugDisplayPatches (const Mat &image, vector< vector< Point > > &msers)
 Visually display patches on image.
void debugDisplayPattern (const Mat &image, Size patternSize, Mat &corners, bool mode=true)
 Visually pattern on image.
void determineFindablePatches (Size patternSize, int mode, int *XVec, int *YVec)
 Determines how many patches can be found in each row and extreme columns.
void determinePatchDistribution (Size patternSize, int mode, int &rows, int &cols, int &quant)
 Determines the distribution of patches based on pattern dimensions and pattern type.
void enclosureFilter (vector< mserPatch > &patches, vector< vector< Point > > &msers)
 Filters out MSERs that are enclosed by or enclose true patches.
void findAllPatches (const Mat &image, Size patternSize, vector< vector< Point > > &msers)
 Find all patches (MSERS - using default settings) in an image.
void findAllPatches2 (const Mat &image, Size patternSize, vector< vector< Point > > &msers, int mserDelta=8, float max_var=0.25, float min_div=0.2, double area_threshold=1.01)
int findBestCorners (const Mat &image, vector< Point2f > &src, vector< Point2f > &dst, Size patternSize, int detector, int searchDist=MAX_SEARCH_DIST)
 Returns the subpixel location of the corner given a decent estimate.
void findCornerPatches (Size imageSize, Size patternSize, int mode, int *XVec, int *YVec, vector< Point2f > &patchCentres, vector< Point2f > &remainingPatches)
 Finds (or simulates) the four corners patches in a pattern.
void findEdgePatches (Size patternSize, int mode, int *XVec, int *YVec, vector< Point2f > &patchCentres, vector< Point2f > &remainingPatches)
 Finds (or simulates) the edge patches in a pattern.
void findInteriorPatches (Size patternSize, int mode, int *XVec, int *YVec, vector< Point2f > &patchCentres, vector< Point2f > &remainingPatches)
 Finds (or simulates) the interior patches in a pattern.
bool findMaskCorners_1 (const Mat &image, Size patternSize, vector< Point2f > &corners, int detector=0)
 MSER-clustering mask corner locater.
bool findMaskCorners_2 (const Mat &image, Size patternSize, vector< Point2f > &corners, int detector=0, int mserDelta=8, float max_var=0.25, float min_div=0.2, double area_threshold=1.01)
bool findPatchCorners (const Mat &image, Size patternSize, Mat &homography, vector< Point2f > &corners, vector< Point2f > &patchCentres2f, int mode, int detector=0)
 Estimates the co-ordinates of the corners of the patches.
bool findPatternCentres (const Mat &image, Size patternSize, vector< Point2f > &centres, int mode)
 Finds just the MSER centres from an image.
bool findPatternCorners (const Mat &image, Size patternSize, vector< Point2f > &corners, int mode, int detector=0)
 Core pattern-finding function.
bool findPatternCorners2 (const Mat &image, Size patternSize, vector< Point2f > &corners, int mode, int detector=0, int mserDelta=8, float max_var=0.25, float min_div=0.2, double area_threshold=1.01)
void generateRandomIndexArray (int *randomArray, int maxElements, int maxVal)
 Generates a random set of indices from a valid range.
void groupPointsInQuads (Size patternSize, vector< Point2f > &corners)
 Converts points ordering from row-by-row to quad-clustered.
void initialRefinementOfCorners (const Mat &imGrey, vector< Point2f > &src, Size patternSize)
 Initial attempt to correct locations of all corners based on estimates from MSER centroids.
void interpolateCornerLocations2 (const Mat &image, int mode, Size patternSize, vector< Point2f > &vCentres, vector< Point2f > &vCorners)
 Estimate the locations of patch corners based on patch centroids.
double obtainSetScore (Mat &distributionMap, Mat &binMap, Mat &gaussianMat, cv::vector< Point2f > &cornerSet, double *radialDistribution)
 Calculate the score for a pointset in terms of its contribution to calibration.
bool patternInFrame (Size imSize, vector< Point2f > &patternPoints, int minBorder=2)
 Checks that the entire pattern is inside the frame by at least a specified margin.
void prepForDisplay (const Mat &distributionMap, Mat &distributionDisplay)
 Blurs and enhances a distribution map to make it more displayable.
void randomCulling (vector< std::string > &inputList, int maxSearch, vector< vector< vector< Point2f > > > &patterns)
 Culls some sets of patterns from a vector vector, and from the corresponding names list.
void randomCulling (vector< std::string > &inputList, int maxSearch, vector< vector< Point2f > > &patterns)
 Culls some patterns from a vector, and from the corresponding names list.
void randomCulling (vector< std::string > &inputList, int maxSearch)
 Randomly cuts down a list of input files.
void reduceCluster (vector< mserPatch > &patches, vector< vector< Point > > &msers, int totalPatches)
 Filters out most deviant patches to retain only the correct number for the pattern.
void refineCornerPositions (const Mat &image, Size patternSize, vector< Point2f > &vCorners)
 Refines positions of corners through iterative local homography mappings.
bool refinePatches (const Mat &image, Size patternSize, vector< vector< Point > > &msers, vector< Point2f > &patchCentres, int mode)
 Applies various area, colour and positional filters to reduce no. of patches to desired amount.
void reorderPatches (Size patternSize, int mode, int *XVec, int *YVec, vector< Point2f > &patchCentres)
 Re-orders patches into row by row, left to right.
void shapeFilter (vector< mserPatch > &patches, vector< vector< Point > > &msers)
 Filters out MSERs that do not have a realistic shape.
void sortCorners (Size imageSize, Size patternSize, vector< Point2f > &corners)
 Sorts the corners into a standard order to prepare for calibration.
void sortPatches (Size imageSize, Size patternSize, vector< Point2f > &patchCentres, int mode)
 Sorts the patches into a standard order to prepare for homography.
void transferMserElement (vector< vector< Point > > &dst, vector< vector< Point > > &src, int index)
 Move a vector of points from one vector of vectors to another.
void transferPatchElement (vector< mserPatch > &dst, vector< mserPatch > &src, int index)
 Move an MSER-patch from one vector to another, resizing and shifting the old vector.
void varianceFilter (vector< mserPatch > &patches, vector< vector< Point > > &msers)
 Filters out MSERs that have a large amount of internal pixel intensity variance.
bool verifyCorners (Size imSize, Size patternSize, vector< Point2f > &patternPoints, double minDist, double maxDist)
 Verifies that the final patches do actually represent a grid pattern.
bool verifyPatches (Size imSize, Size patternSize, vector< Point2f > &patchCentres, int mode, double minDist, double maxDist)
 Verifies that the final patches do actually represent a grid pattern.
bool verifyPattern (Size imSize, Size patternSize, vector< Point2f > &patternPoints, double minDist, double maxDist)
 Generic grid verification function.

Detailed Description

Declarations for generic geometric calibration.

Definition in file calibration.hpp.


Define Documentation

#define ALL_PATTERNS_OPTIMIZATION_CODE   0

Definition at line 32 of file calibration.hpp.

#define BEST_OF_RANDOM_PATTERNS_OPTIMIZATION_CODE   4

Definition at line 36 of file calibration.hpp.

#define CHESSBOARD_FINDER_CODE   0

Definition at line 28 of file calibration.hpp.

#define DEBUG_MODE   0

Definition at line 41 of file calibration.hpp.

#define ENHANCED_MCM_OPTIMIZATION_CODE   3

Definition at line 35 of file calibration.hpp.

#define EXHAUSTIVE_SEARCH_OPTIMIZATION_CODE   5

Definition at line 37 of file calibration.hpp.

#define EXTENDED_CHESSBOARD_FINDER   5

Definition at line 57 of file calibration.hpp.

#define FIRST_N_PATTERNS_OPTIMIZATION_CODE   2

Definition at line 34 of file calibration.hpp.

#define FOLD_COUNT   1

Definition at line 47 of file calibration.hpp.

#define HEATED_CHESSBOARD_FINDER_CODE   2

Definition at line 30 of file calibration.hpp.

#define INVERTED_OPENCV_CHESSBOARD_FINDER   10

Definition at line 58 of file calibration.hpp.

#define MASK_FINDER   3

Definition at line 55 of file calibration.hpp.

#define MASK_FINDER_CODE   1

Definition at line 29 of file calibration.hpp.

#define MASK_FINDER_INNERS   8

Definition at line 56 of file calibration.hpp.

#define MAX_CAMS   3

Definition at line 51 of file calibration.hpp.

#define MAX_CANDIDATE_PATTERNS   100

Definition at line 65 of file calibration.hpp.

#define MAX_FRAMES_PER_INPUT   5000

Definition at line 62 of file calibration.hpp.

#define MAX_FRAMES_TO_LOAD   1000

Definition at line 63 of file calibration.hpp.

#define MAX_PATTERNS_PER_SET   10

Definition at line 66 of file calibration.hpp.

#define MAX_PATTERNS_TO_KEEP   500

Definition at line 64 of file calibration.hpp.

#define MAX_SEARCH_DIST   3

Definition at line 52 of file calibration.hpp.

#define MIN_DISTANCE_FROM_EDGE   2

Definition at line 60 of file calibration.hpp.

#define PATCH_CORRECTION_INTRINSICS_FLAGS   CV_CALIB_RATIONAL_MODEL

Definition at line 68 of file calibration.hpp.

#define PATTERN_FINDER_CV_CORNER_SUBPIX_FLAG   4

Definition at line 43 of file calibration.hpp.

#define PI   3.14159265

Definition at line 49 of file calibration.hpp.

#define RADIAL_LENGTH   1000

Definition at line 46 of file calibration.hpp.

#define RANDOM_SEED_OPTIMIZATION_CODE   6

Definition at line 38 of file calibration.hpp.

#define RANDOM_SET_OPTIMIZATION_CODE   1

Definition at line 33 of file calibration.hpp.

#define REGULAR_OPENCV_CHESSBOARD_FINDER   0

Definition at line 54 of file calibration.hpp.

#define SCORE_BASED_OPTIMIZATION_CODE   7

Definition at line 39 of file calibration.hpp.

#define TRACKING   0

Definition at line 45 of file calibration.hpp.


Function Documentation

void addToBinMap ( Mat &  binMap,
cv::vector< Point2f > &  cornerSet,
Size  imSize 
)

Add a cornerset to the tally matrix.

Definition at line 1954 of file calibration.cpp.

void addToDistributionMap ( Mat &  distributionMap,
vector< Point2f > &  corners 
)

Measures the coverage of a cameras field of view by analysing the distribution tally.

Definition at line 2015 of file calibration.cpp.

void addToRadialDistribution ( double *  radialDistribution,
cv::vector< Point2f > &  cornerSet,
Size  imSize 
)

Adds a pointset to a radial distribution array.

Definition at line 1986 of file calibration.cpp.

bool checkAcutance (  ) 

Checks validity of image for calibration.

Definition at line 155 of file calibration.cpp.

void clusterFilter ( vector< mserPatch > &  patches,
vector< vector< Point > > &  msers,
int  totalPatches 
)

Filters out MSERs that cannot possibly be part of the geometric pattern.

Definition at line 4180 of file calibration.cpp.

bool correctPatchCentres ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  patchCentres,
int  mode 
)

Uses contrast enhancement etc to improve positional estimates of patch centres.

Definition at line 3322 of file calibration.cpp.

void debugDisplayPatches ( const Mat &  image,
vector< vector< Point > > &  msers 
)

Visually display patches on image.

Definition at line 434 of file calibration.cpp.

void debugDisplayPattern ( const Mat &  image,
Size  patternSize,
Mat &  corners,
bool  mode = true 
)

Visually pattern on image.

Definition at line 1410 of file calibration.cpp.

void determineFindablePatches ( Size  patternSize,
int  mode,
int *  XVec,
int *  YVec 
)

Determines how many patches can be found in each row and extreme columns.

Definition at line 458 of file calibration.cpp.

void determinePatchDistribution ( Size  patternSize,
int  mode,
int &  rows,
int &  cols,
int &  quant 
)

Determines the distribution of patches based on pattern dimensions and pattern type.

Definition at line 162 of file calibration.cpp.

void enclosureFilter ( vector< mserPatch > &  patches,
vector< vector< Point > > &  msers 
)

Filters out MSERs that are enclosed by or enclose true patches.

Definition at line 3962 of file calibration.cpp.

void findAllPatches ( const Mat &  image,
Size  patternSize,
vector< vector< Point > > &  msers 
)

Find all patches (MSERS - using default settings) in an image.

Definition at line 179 of file calibration.cpp.

void findAllPatches2 ( const Mat &  image,
Size  patternSize,
vector< vector< Point > > &  msers,
int  mserDelta = 8,
float  max_var = 0.25,
float  min_div = 0.2,
double  area_threshold = 1.01 
)

Definition at line 280 of file calibration.cpp.

int findBestCorners ( const Mat &  image,
vector< Point2f > &  src,
vector< Point2f > &  dst,
Size  patternSize,
int  detector,
int  searchDist = MAX_SEARCH_DIST 
)

Returns the subpixel location of the corner given a decent estimate.

Definition at line 2882 of file calibration.cpp.

void findCornerPatches ( Size  imageSize,
Size  patternSize,
int  mode,
int *  XVec,
int *  YVec,
vector< Point2f > &  patchCentres,
vector< Point2f > &  remainingPatches 
)

Finds (or simulates) the four corners patches in a pattern.

Definition at line 538 of file calibration.cpp.

void findEdgePatches ( Size  patternSize,
int  mode,
int *  XVec,
int *  YVec,
vector< Point2f > &  patchCentres,
vector< Point2f > &  remainingPatches 
)

Finds (or simulates) the edge patches in a pattern.

Definition at line 801 of file calibration.cpp.

void findInteriorPatches ( Size  patternSize,
int  mode,
int *  XVec,
int *  YVec,
vector< Point2f > &  patchCentres,
vector< Point2f > &  remainingPatches 
)

Finds (or simulates) the interior patches in a pattern.

Definition at line 1015 of file calibration.cpp.

bool findMaskCorners_1 ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  corners,
int  detector = 0 
)

MSER-clustering mask corner locater.

Definition at line 129 of file calibration.cpp.

bool findMaskCorners_2 ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  corners,
int  detector = 0,
int  mserDelta = 8,
float  max_var = 0.25,
float  min_div = 0.2,
double  area_threshold = 1.01 
)

Definition at line 142 of file calibration.cpp.

bool findPatchCorners ( const Mat &  image,
Size  patternSize,
Mat &  homography,
vector< Point2f > &  corners,
vector< Point2f > &  patchCentres2f,
int  mode,
int  detector = 0 
)

Estimates the co-ordinates of the corners of the patches.

Definition at line 2215 of file calibration.cpp.

bool findPatternCentres ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  centres,
int  mode 
)

Finds just the MSER centres from an image.

Definition at line 3585 of file calibration.cpp.

bool findPatternCorners ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  corners,
int  mode,
int  detector = 0 
)

Core pattern-finding function.

Definition at line 1445 of file calibration.cpp.

bool findPatternCorners2 ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  corners,
int  mode,
int  detector = 0,
int  mserDelta = 8,
float  max_var = 0.25,
float  min_div = 0.2,
double  area_threshold = 1.01 
)

Definition at line 1599 of file calibration.cpp.

void generateRandomIndexArray ( int *  randomArray,
int  maxElements,
int  maxVal 
)

Generates a random set of indices from a valid range.

Definition at line 7 of file calibration.cpp.

void groupPointsInQuads ( Size  patternSize,
vector< Point2f > &  corners 
)

Converts points ordering from row-by-row to quad-clustered.

Definition at line 2855 of file calibration.cpp.

void initialRefinementOfCorners ( const Mat &  imGrey,
vector< Point2f > &  src,
Size  patternSize 
)

Initial attempt to correct locations of all corners based on estimates from MSER centroids.

Definition at line 3171 of file calibration.cpp.

void interpolateCornerLocations2 ( const Mat &  image,
int  mode,
Size  patternSize,
vector< Point2f > &  vCentres,
vector< Point2f > &  vCorners 
)

Estimate the locations of patch corners based on patch centroids.

Definition at line 1753 of file calibration.cpp.

double obtainSetScore ( Mat &  distributionMap,
Mat &  binMap,
Mat &  gaussianMat,
cv::vector< Point2f > &  cornerSet,
double *  radialDistribution 
)

Calculate the score for a pointset in terms of its contribution to calibration.

Definition at line 2023 of file calibration.cpp.

bool patternInFrame ( Size  imSize,
vector< Point2f > &  patternPoints,
int  minBorder = 2 
)

Checks that the entire pattern is inside the frame by at least a specified margin.

Definition at line 3873 of file calibration.cpp.

void prepForDisplay ( const Mat &  distributionMap,
Mat &  distributionDisplay 
)

Blurs and enhances a distribution map to make it more displayable.

Definition at line 1968 of file calibration.cpp.

void randomCulling ( vector< std::string > &  inputList,
int  maxSearch,
vector< vector< vector< Point2f > > > &  patterns 
)

Culls some sets of patterns from a vector vector, and from the corresponding names list.

void randomCulling ( vector< std::string > &  inputList,
int  maxSearch,
vector< vector< Point2f > > &  patterns 
)

Culls some patterns from a vector, and from the corresponding names list.

Definition at line 394 of file calibration.cpp.

void randomCulling ( vector< std::string > &  inputList,
int  maxSearch 
)

Randomly cuts down a list of input files.

Definition at line 380 of file calibration.cpp.

void reduceCluster ( vector< mserPatch > &  patches,
vector< vector< Point > > &  msers,
int  totalPatches 
)

Filters out most deviant patches to retain only the correct number for the pattern.

Definition at line 4095 of file calibration.cpp.

void refineCornerPositions ( const Mat &  image,
Size  patternSize,
vector< Point2f > &  vCorners 
)

Refines positions of corners through iterative local homography mappings.

Definition at line 2307 of file calibration.cpp.

bool refinePatches ( const Mat &  image,
Size  patternSize,
vector< vector< Point > > &  msers,
vector< Point2f > &  patchCentres,
int  mode 
)

Applies various area, colour and positional filters to reduce no. of patches to desired amount.

Definition at line 4429 of file calibration.cpp.

void reorderPatches ( Size  patternSize,
int  mode,
int *  XVec,
int *  YVec,
vector< Point2f > &  patchCentres 
)

Re-orders patches into row by row, left to right.

Definition at line 1322 of file calibration.cpp.

void shapeFilter ( vector< mserPatch > &  patches,
vector< vector< Point > > &  msers 
)

Filters out MSERs that do not have a realistic shape.

Definition at line 3893 of file calibration.cpp.

void sortCorners ( Size  imageSize,
Size  patternSize,
vector< Point2f > &  corners 
)

Sorts the corners into a standard order to prepare for calibration.

Definition at line 3280 of file calibration.cpp.

void sortPatches ( Size  imageSize,
Size  patternSize,
vector< Point2f > &  patchCentres,
int  mode 
)

Sorts the patches into a standard order to prepare for homography.

Definition at line 1232 of file calibration.cpp.

void transferMserElement ( vector< vector< Point > > &  dst,
vector< vector< Point > > &  src,
int  index 
)

Move a vector of points from one vector of vectors to another.

Definition at line 4417 of file calibration.cpp.

void transferPatchElement ( vector< mserPatch > &  dst,
vector< mserPatch > &  src,
int  index 
)

Move an MSER-patch from one vector to another, resizing and shifting the old vector.

Definition at line 4405 of file calibration.cpp.

void varianceFilter ( vector< mserPatch > &  patches,
vector< vector< Point > > &  msers 
)

Filters out MSERs that have a large amount of internal pixel intensity variance.

Definition at line 3934 of file calibration.cpp.

bool verifyCorners ( Size  imSize,
Size  patternSize,
vector< Point2f > &  patternPoints,
double  minDist,
double  maxDist 
)

Verifies that the final patches do actually represent a grid pattern.

Definition at line 2295 of file calibration.cpp.

bool verifyPatches ( Size  imSize,
Size  patternSize,
vector< Point2f > &  patchCentres,
int  mode,
double  minDist,
double  maxDist 
)

Verifies that the final patches do actually represent a grid pattern.

Definition at line 3831 of file calibration.cpp.

bool verifyPattern ( Size  imSize,
Size  patternSize,
vector< Point2f > &  patternPoints,
double  minDist,
double  maxDist 
)

Generic grid verification function.

Definition at line 3667 of file calibration.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


thermalvis
Author(s): Stephen Vidas
autogenerated on Tue Mar 5 12:25:26 2013