Landmark-Based Calibration Code Snippet (Legacy)¶
This code snippet shows how to perform a landmark-based calibration using the legacy EasyGauge API.
C++¶
#include <eVision/EasyGauge/Legacy/EWorldShape.h>
using namespace eVision;
using namespace eVision::Legacy;
// EWorldShape constructor
EWorldShape worldShape;
// ...
int numLandmarks(20);
// Reset the calibration context
worldShape.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
worldShape.AddLandmark(sensorPoint, worldPoint);
}
// Perform the calibration
worldShape.Calibrate(ECalibrationMode_Skewed);
C#¶
using eVision;
using Legacy = eVision.Legacy;
// EWorldShape constructor
Legacy.EWorldShape worldShape = new Legacy.EWorldShape();
// ...
// Reset the calibration context
worldShape.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
worldShape.AddLandmark(sensorPoint, worldPoint);
}
// Perform the calibration
worldShape.Calibrate((int)ECalibrationMode.Skewed);
Python¶
import eVision
import eVision.Legacy as Legacy
# EWorldShape constructor
world_shape = Legacy.EWorldShape()
# ...
# Reset the calibration context
world_shape.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
world_shape.AddLandmark(sensorPoint, worldPoint)
# Perform the calibration
world_shape.Calibrate(eVision.ECalibrationMode.Skewed)