AURobotServers
4
|
#include <ucalibrate.h>
Public Member Functions | |
void | clear () |
int | countSetsWith (unsigned int codeValue) |
bool | doEstimateCameraParameters (UCamPar *oldEstimate, bool debug) |
bool | doEstimateCameraParametersBinary (UCamPar *oldEstimate, bool debug, unsigned long setsToUse, bool alsoFocalLength, bool alsoK1, bool alsoK2) |
bool | doEstimateCameraParametersCarpet (UCamPar *oldEstimate, bool debug) |
UPosition | getCalibrationChartPosition () |
UCamPar * | getCamPar () |
UCalibrationMarkSet * | getNewSet () |
int | getSavedSets () |
UCalibrationMarkSet * | getSet (int setNumber) |
UCalibrationMarkSet * | getThisSet (unsigned int codeValue, int nth) |
bool | saveNewSet (UCalibrationMarkSet *frameSet) |
void | setCalibrationChartPosition (UPosition newChartPos) |
void | setCameraParameters (float hx, float hy, float k1, float k2, float f, float resFactor, char *name) |
void | setCameraParameters (UCamPar *camPar) |
void | toLog (const char *info, int significance, UTime *timestamp=NULL) |
UCalibrationMarkSets () | |
~UCalibrationMarkSets () | |
Private Member Functions | |
float | evaluatek1PixError (UCalibrationMarkSet *cset[], unsigned int sets_used, const float hx, const float hy, const float k1min, float k1max, float *k1e, int steps1, const float k2min, float k2max, float *k2e, int steps2, const float c, float pixSize, bool alsoK1, bool alsoK2) |
float | evaluatek2PixError (UCalibrationMarkSet *cset[], unsigned int sets_used, const float hx, const float hy, const float k1, const float k2min, float k2max, float *k2e, int steps, const float c, float pixSize, bool alsoK2) |
float | evaluatePixError (UCalibrationMarkSet *cset[], unsigned int sets_used, const float hx, const float hy, const float k1, const float k2, const float c, float pixSize) |
Private Attributes | |
UPosition | chartPos |
UCamParEst | estCamPar |
UCalibrationMarkSet | set [MAX_CALIBRATION_SETS_SAVED] |
int | setCnt |
Class to hold calibration mark sets for a number of images (or for a number of barcode frames). For each frame the position of all frame positions are saved for calibrtion purposes or for calculation of camera or barcode position.
UCalibrationMarkSets::UCalibrationMarkSets | ( | ) |
Constructor
|
inline |
Destructor
void UCalibrationMarkSets::clear | ( | void | ) |
initialize flags.
int UCalibrationMarkSets::countSetsWith | ( | unsigned int | codeValue | ) |
Returns count of data sets with this barcode value.
bool UCalibrationMarkSets::doEstimateCameraParameters | ( | UCamPar * | oldEstimate, |
bool | debug | ||
) |
Calculate camera internal parameters. Assume that each set has an associated chart position. Make an parameter least square estimate based in 4 corners in each (of 5) dataset. With the new estimate make a new position estimate for each set, then verify error size, to exit if error is minimum. REturns false if no result.
References UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::geterrorInPixels(), UCalibrationMark::ix, UCalibrationMark::iy, UCalibrationMarkSet::mark, UCalibrationMarkSet::markCnt, UCalibrationMarkSet::pixSize, UCalibrationMarkSet::posBarcode, UCalibrationMarkSet::rotBarcode, UCalibrationMark::rx, UCalibrationMark::ry, UPosition::set(), and UCalibrationComponents::toLog().
bool UCalibrationMarkSets::doEstimateCameraParametersBinary | ( | UCamPar * | oldEstimate, |
bool | debug, | ||
unsigned long | setsToUse, | ||
bool | alsoFocalLength, | ||
bool | alsoK1, | ||
bool | alsoK2 | ||
) |
Do binary search in an attempt to find parameters,
References absf(), UCamPar::getPixelSize(), UCalibrationMark::ix, UCalibrationMark::iy, UCalibrationMarkSet::mark, UCalibrationMarkSet::markCnt, UCalibrationMarkSet::pixSize, UCalibrationMarkSet::posBarcode, UCalibrationMarkSet::rotBarcode, UCalibrationMark::rx, UCalibrationMark::ry, UPosition::set(), and UCalibrationComponents::toLog().
bool UCalibrationMarkSets::doEstimateCameraParametersCarpet | ( | UCamPar * | oldEstimate, |
bool | debug | ||
) |
Depricated method to find camera parameters (test all positions)
References UCalibrationMark::ix, UCalibrationMark::iy, UCalibrationMarkSet::mark, UCalibrationMarkSet::markCnt, UCalibrationMarkSet::pixSize, UCalibrationMarkSet::posBarcode, UCalibrationMarkSet::rotBarcode, UCalibrationMark::rx, UCalibrationMark::ry, UPosition::set(), and UCalibrationComponents::toLog().
|
private |
Estimate k1 and k2 parameters within the provided limits using binary search. Returns pixel error on best estimate and estimated parameters in 'k1e' and 'k2e' parameter.
References UCalibrationComponents::toLog().
|
private |
Estimate k2 parameter within the provided limits using a binary search. Returns pixel error on best estimate and estimated parameter in 'k2e' parameter.
|
private |
Evaluate position and rotation of each guidemark with this set of parameters and return the average pixel error.
References UCalibrationMarkSet::evaluateChartPosRot(), UCalibrationMarkSet::geterrorInPixels(), UCalibrationMarkSet::posBarcode, and UCalibrationMarkSet::rotBarcode.
|
inline |
Get calibration chart position
|
inline |
Get pointer to camera parameters used in estimation process.
References UCalibXYStat::clear().
UCalibrationMarkSet * UCalibrationMarkSets::getNewSet | ( | ) |
Get new calibration mark set - if any more space.
References UCalibrationMarkSet::clear(), MAX_CALIBRATION_SETS_SAVED, and mini().
int UCalibrationMarkSets::getSavedSets | ( | ) |
Get number of (valid) saved sets
UCalibrationMarkSet * UCalibrationMarkSets::getSet | ( | int | setNumber | ) |
Get pointer to calibration set. Returns NULL if not within range present count.
UCalibrationMarkSet * UCalibrationMarkSets::getThisSet | ( | unsigned int | codeValue, |
int | nth | ||
) |
Get a pointer to the n'th set with this barcode value. first set with this code has number 0. Returns NULL if it do not exist.
bool UCalibrationMarkSets::saveNewSet | ( | UCalibrationMarkSet * | frameSet | ) |
Save this barcode position set for later camera parameter estimation purpose. If no more space for sets or set is not valid, then return false.
References UCalibrationMarkSet::barcodeValid, and UCalibrationMarkSet::valid.
|
inline |
Set new calibration chart position
|
inline |
Set camera parameters
|
inline |
Set camera parameters from copy
|
inline |
Save this message in logfile if significance is less than logLevel. Print also to console (debug feature) if verbose messages. Timestamp is optional, if not used, then Now() is used in logfile.
References toLogGmk().
|
private |
Known position of the calibration chart. for camera position evaluation Set from configuration file, or manually.
|
private |
Estimated camera internal parameters.
|
private |
One set of calibration marks for each (possible) camera device.
|
private |