Object-Based Calibration¶
This code snippet shows how to perform object-based calibration.
C++¶
#include <eVision/Easy3D/Easy3DLaserLine/EObjectBasedCalibrationModel.h>
#include <eVision/Easy3D/Easy3DLaserLine/EObjectBasedCalibrationGenerator.h>
using namespace eVision;
using namespace eVision::Easy3D;
// Initialize a depth map from an image of a double truncated pyramid
EDepthMap16 depth_map;
depth_map.LoadImage("ctx1 calibration object.png"); // from Easy3D sample images
depth_map.SetZResolution(1.f / (1 << 5)); // 11.5 fixed point pixel format
// Initialize the calibration generator
EObjectBasedCalibrationGenerator calib_generator;
calib_generator.SetCalibrationObjectType(EObjectBasedCalibrationType_TruncatedDoublePyramid, 40.f, 60.f, 10.f); // Type and size of the calibration object
// Compute the calibration model
EObjectBasedCalibrationModel calib_model = calib_generator.Compute(depth_map);
float error = calib_model.GetCalibrationError();
// Save the calibration model
calib_model.Save("calib.model");
C#¶
using eVision;
using eVision.Easy3D;
// Initialize a depth map from an image of a double truncated pyramid
EDepthMap16 depth_map = new EDepthMap16();
depth_map.LoadImage("ctx1 calibration object.png"); // from Easy3D sample images
depth_map.ZResolution = 1.0F / 32.0F; // 11.5 fixed point pixel format
// Initialize the calibration generator
EObjectBasedCalibrationGenerator calib_generator = new EObjectBasedCalibrationGenerator();
calib_generator.SetCalibrationObjectType(EObjectBasedCalibrationType.TruncatedDoublePyramid, 40.0F, 60.0F, 10.0F); // Type and size of the calibration object
// Compute the calibration model
EObjectBasedCalibrationModel calib_model = calib_generator.Compute(depth_map);
float error = calib_model.CalibrationError;
// Save the calibration model
calib_model.Save("calib.model");
Python¶
from eVision import Easy3D
# Initialize a depth map from an image of a double truncated pyramid
depth_map = Easy3D.EDepthMap16()
depth_map.LoadImage("ctx1 calibration object.png") # from Easy3D sample images
depth_map.ZResolution = 1.0 / 32.0 # 11.5 fixed point pixel format
# Initialize the calibration generator
calib_generator = Easy3D.EObjectBasedCalibrationGenerator()
calib_generator.SetCalibrationObjectType(Easy3D.EObjectBasedCalibrationType.TruncatedDoublePyramid, 40.0, 60.0, 10.0) # Type and size of the calibration object
# Compute the calibration model
calib_model = calib_generator.Compute(depth_map)
error = calib_model.CalibrationError
# Save the calibration model
calib_model.Save("calib.model")