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