Interface object for camera calibration and correction of image distortion.
More...
#include <CameraCalibrator.h>
|
void | initCalibration (const CalibrationSettings settings) |
| Initialize the calibration process. All previous accepted patterns will be removed. More...
|
|
void | addImage (const RawImage image, bool *pattern_found, bool *pattern_accepted, std::vector< Point > *pattern_points) |
| Search a pattern in the image and store it. More...
|
|
float | getPatternSpaceCoverProgress () const |
| Evaluate covering of the pattern space to get more accurate calibration. More...
|
|
std::vector< Point > | getTip () |
| Get a tip where to put a pattern in the image to get a better pattern space coverage. More...
|
|
bool | calibrate (const int max_used_patterns_count, float *reprojection_error) |
| Calibrate the camera. More...
|
|
IRawImage::Ptr | undistort (const RawImage image, const float alpha) const |
| Correct the image distortion using the calibrated or loaded camera parameters. More...
|
|
void | saveCameraParameters (std::ostream &binary_stream) const |
| Save the calibrated camera parameters to binary_stream. The format is platform-independent. More...
|
|
void | saveCameraParameters (pbio::stl_wraps::WrapOStream &binary_stream) const |
| Save the calibrated camera parameters to binary_stream. The format is platform-independent. More...
|
|
void | loadCameraParameters (std::istream &binary_stream) |
| Load the calibrated camera parameters from binary_stream. The format is platform-independent. More...
|
|
void | loadCameraParameters (pbio::stl_wraps::WrapIStream &binary_stream) |
| Load the calibrated camera parameters from binary_stream. The format is platform-independent. More...
|
|
Interface object for camera calibration and correction of image distortion.
void pbio::CameraCalibrator::addImage |
( |
const RawImage |
image, |
|
|
bool * |
pattern_found, |
|
|
bool * |
pattern_accepted, |
|
|
std::vector< Point > * |
pattern_points |
|
) |
| |
|
inline |
Search a pattern in the image and store it.
- Parameters
-
[in] | image | An image or a videoframe. |
[out] | pattern_found | The pattern was successfully found in a given image. Can be NULL. |
[out] | pattern_accepted | The found pattern was accepted (i.e., it differs significantly from the patterns already accepted). Can be NULL. |
[out] | pattern_points | Points of a detected pattern. Can be NULL. |
bool pbio::CameraCalibrator::calibrate |
( |
const int |
max_used_patterns_count, |
|
|
float * |
reprojection_error |
|
) |
| |
|
inline |
Calibrate the camera.
- Parameters
-
[in] | max_used_patterns_count | Maximum number of patterns to use for calculation. If more patterns are accepted, the subset covering the pattern space best will be used. The recommended value is 50. |
[out] | reprojection_error | Average reprojection error. Normal values are about 1 or lower. |
- Returns
- true, if the calibration was successful, otherwise false.
float pbio::CameraCalibrator::getPatternSpaceCoverProgress |
( |
| ) |
const |
|
inline |
Evaluate covering of the pattern space to get more accurate calibration.
- Returns
- A real number from 0 to 1.
std::vector< Point > pbio::CameraCalibrator::getTip |
( |
| ) |
|
|
inline |
Get a tip where to put a pattern in the image to get a better pattern space coverage.
- Returns
- An empty vector if the tip is not ready, or a vector of pattern points.
Initialize the calibration process. All previous accepted patterns will be removed.
- Parameters
-
[in] | settings | Calibration process settings. |
void pbio::CameraCalibrator::loadCameraParameters |
( |
std::istream & |
binary_stream | ) |
|
|
inline |
Load the calibrated camera parameters from binary_stream. The format is platform-independent.
- Parameters
-
[in] | binary_stream | Input stream object. The file stream (std::ifstream) must be opened with the std::ios_base::binary flag. |
void pbio::CameraCalibrator::loadCameraParameters |
( |
pbio::stl_wraps::WrapIStream & |
binary_stream | ) |
|
|
inline |
Load the calibrated camera parameters from binary_stream. The format is platform-independent.
- Parameters
-
[in] | binary_stream | Input stream object. The file stream (std::ifstream) must be opened with the std::ios_base::binary flag. |
void pbio::CameraCalibrator::saveCameraParameters |
( |
std::ostream & |
binary_stream | ) |
const |
|
inline |
Save the calibrated camera parameters to binary_stream. The format is platform-independent.
- Parameters
-
[out] | binary_stream | Output stream object. The file stream (std::ofstream) must be opened with the std::ios_base::binary flag. |
void pbio::CameraCalibrator::saveCameraParameters |
( |
pbio::stl_wraps::WrapOStream & |
binary_stream | ) |
const |
|
inline |
Save the calibrated camera parameters to binary_stream. The format is platform-independent.
- Parameters
-
[out] | binary_stream | Output stream object. The file stream (std::ofstream) must be opened with the std::ios_base::binary flag. |
Correct the image distortion using the calibrated or loaded camera parameters.
- Parameters
-
[in] | image | An image or a videoframe. The size can differ from the size of the images used for calibration. I.e. you can calibrate a camera once with one resolution and then calibrate the distortion of images from the same camera with any resolution. |
[in] | alpha | A real value from 0 (the result image contains only valid pixels (no black areas)) to 1 (all pixels from the original image are stored in the result image (no source image pixels are lost)). Intermediate values yield an intermediate result between those two extreme cases. |
- Returns
- Undistorted image of the same size and type as the source image.