Dot Grid-Based Calibration Code Snippet (Legacy)¶
This code snippet shows how to perform a dot grid-based calibration using the legacy EasyGauge API.
C++¶
#include <eVision/EasyGauge/Legacy/EWorldShape.h>
#include <eVision/Easy/EUnwarpingLut.h>
using namespace eVision;
using namespace eVision::Legacy;
// EWorldShape constructor
EWorldShape worldShape;
// ...
// Reset the calibration context
worldShape.EmptyLandmarks();
int numDots(30);
// Loop on the dots
for (int index = 0; index < numDots; index++)
{
// Get the I-th dot as an EPoint(x, y)
EPoint dotPoint;
// Retrieve and store the relevant data into dotPoint
// ...
// Add the I-th dot
worldShape.AddPoint(dotPoint);
}
// Reconstruct the grid topology
// pitch X and Y = 5 units
unsigned int connectedPoints = worldShape.RebuildGrid(5, 5);
// Perform the calibration
// the calibration modes are computed automatically
unsigned int bestCalibrationModes = worldShape.AutoCalibrate(true);
C#¶
using eVision;
using Legacy = eVision.Legacy;
// EWorldShape constructor
Legacy.EWorldShape worldShape = new Legacy.EWorldShape();
// ...
// Reset the calibration context
worldShape.EmptyLandmarks();
// Loop on the dots
int numDots = 30;
for (int index = 0; index < numDots; index++)
{
// Get the I-th dot as an EPoint(x, y)
EPoint dotPoint = new EPoint();
// Retrieve and store the relevant data into dotPoint
// Add the I-th dot
worldShape.AddPoint(dotPoint);
}
// Reconstruct the grid topology
// pitch X and Y = 5 units
uint connectedPoints = worldShape.RebuildGrid(5, 5);
// Perform the calibration
// the calibration modes are computed automatically
uint bestCalibrationModes = worldShape.AutoCalibrate(true);
Python¶
import eVision
import eVision.Legacy as Legacy
# EWorldShape constructor
world_shape = Legacy.EWorldShape()
# ...
# Reset the calibration context
world_shape.EmptyLandmarks()
# Loop on the dots
numDots = 30
for i in range(numDots):
# Get the I-th dot as an EPoint(x, y)
dotPoint = eVision.EPoint()
# Retrieve and store the relevant data into dotPoint
# Add the I-th dot
world_shape.AddPoint(dotPoint)
# Reconstruct the grid topology
# pitch X and Y = 5 units
connected_points = world_shape.RebuildGrid(5, 5)
# Perform the calibration
# the calibration modes are computed automatically
best_calibration_modes = world_shape.AutoCalibrate(True)