Landmark-Based Calibration Code Snippet¶
This code snippet shows how to perform a landmark-based calibration.
C++¶
#include <eVision/Easy/ECameraCalibration.h>
#include <eVision/Easy/ECalibrationMode.h>
using namespace eVision;
// ECameraCalibration constructor
ECameraCalibration calib;
// ...
int numLandmarks(20);
// Reset the calibration context
calib.EmptyLandmarks();
// Loop on the landmarks
for (int index = 0; index < numLandmarks; index++)
{
// Get the I-th landmark as a pair of EPoint(x, y)
EPoint sensorPoint, worldPoint;
// Retrieve and store the relevant data into worldPoint and sensorPoint
// ...
// Add the I-th pair
calib.AddLandmark(sensorPoint, worldPoint);
}
// Perform the calibration
calib.Calibrate(ECalibrationMode_Skewed);
C#¶
using eVision;
// ECameraCalibration constructor
ECameraCalibration calib = new ECameraCalibration();
// ...
// Reset the calibration context
calib.EmptyLandmarks();
int numLandmarks = 20;
// Loop on the landmarks
for (int index = 0; index < numLandmarks; index++)
{
// Get the I-th landmark as a pair of EPoint(x, y)
EPoint sensorPoint = new EPoint(), worldPoint = new EPoint();
// Retrieve and store the relevant data into worldPoint and sensorPoint
// ...
// Add the I-th pair
calib.AddLandmark(sensorPoint, worldPoint);
}
// Perform the calibration
calib.Calibrate((int)ECalibrationMode.Skewed);
Python¶
import eVision
# ECameraCalibration constructor
calib = eVision.ECameraCalibration()
# ...
# Reset the calibration context
calib.EmptyLandmarks()
num_landmarks = 20
# Loop on the landmarks
for index in range(num_landmarks):
# Get the I-th landmark as a pair of EPoint(x, y)
sensorPoint = eVision.EPoint()
worldPoint = eVision.EPoint()
# Retrieve and store the relevant data into worldPoint and sensorPoint
# ...
# Add the I-th pair
calib.AddLandmark(sensorPoint, worldPoint)
# Perform the calibration
calib.Calibrate(eVision.ECalibrationMode.Skewed)