Image Unwarping Code Snippet (Legacy)¶
This code snippet shows how to unwarp an image based on the computed calibration coefficients by using the legacy EasyGauge API.
C++¶
#include <eVision/EasyGauge/Legacy/EWorldShape.h>
#include <eVision/Easy/EUnwarpingLut.h>
using namespace eVision;
using namespace eVision::Legacy;
// Images constructor
EImageBW8 srcImage;
EImageBW8 dstImage;
// EWorldShape constructor
EWorldShape worldShape;
// Lookup table constructor
EUnwarpingLut lut;
// ...
// Perform the calibration
worldShape.Calibrate(ECalibrationMode_Tilted | ECalibrationMode_Radial);
// Setup the lookup table for unwarping
worldShape.SetupUnwarp(&lut, &srcImage, true);
// Perform the image unwarping
worldShape.Unwarp(&lut, &srcImage, &dstImage, true);
C#¶
using eVision;
using Legacy = eVision.Legacy;
// Images constructor
EImageBW8 srcImage = new EImageBW8();
EImageBW8 dstImage = new EImageBW8();
// EWorldShape constructor
Legacy.EWorldShape worldShape = new Legacy.EWorldShape();
// Lookup table constructor
EUnwarpingLut lut = new EUnwarpingLut();
// ...
// Perform the calibration
worldShape.Calibrate((int)ECalibrationMode.Tilted | (int)ECalibrationMode.Radial);
// Setup the lookup table for unwarping
worldShape.SetupUnwarp(lut, srcImage, true);
// Perform the image unwarping
worldShape.Unwarp(lut, srcImage, dstImage, true);
Python¶
import eVision
import eVision.Legacy as Legacy
# Images constructor
src_image = eVision.EImageBW8()
dst_image = eVision.EImageBW8()
# EWorldShape constructor
world_shape = Legacy.EWorldShape()
# Lookup table constructor
lut = eVision.EUnwarpingLut()
# ...
# Perform the calibration
world_shape.Calibrate(eVision.ECalibrationMode.Tilted | eVision.ECalibrationMode.Radial)
# Setup the lookup table for unwarping
world_shape.SetupUnwarp(lut, src_image, True)
# Perform the image unwarping
world_shape.Unwarp(lut, src_image, dst_image, True)