Calibration by Guesswork Code Snippet

This code snippet shows how to perform a calibration by guesswork.

C++

#include <eVision/Easy/ECameraCalibration.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// ECameraCalibration constructor
ECameraCalibration calib;
// ...
// Compute the calibration coefficients
// Field of view: 32x24 mm
calib.SetSensor(srcImage.GetWidth(), srcImage.GetHeight(), 32.f, 24.f);
// Retrieve the spatial resolution
float resolutionX = calib.GetXResolution();
float resolutionY = calib.GetYResolution();

C#

using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// ECameraCalibration constructor
ECameraCalibration calib = new ECameraCalibration();
// ...
// Compute the calibration coefficients
// Field of view: 32x24 mm
calib.SetSensor(srcImage.Width, srcImage.Height, 32.0f, 24.0f);
// Retrieve the spatial resolution
float resolutionX = calib.XResolution;
float resolutionY = calib.YResolution;

Python

import eVision
# Image constructor
src_image = eVision.EImageBW8()
# ECameraCalibration constructor
calib = eVision.ECameraCalibration()
# ...
# Compute the calibration coefficients
# Field of view: 32x24 mm
calib.SetSensor(src_image.Width, src_image.Height, 32.0, 24.0)
# Retrieve the spatial resolution
resolutionX = calib.XResolution
resolutionY = calib.YResolution