Calibration Information
Calibration Information may be provided to fluxEngine in order specify additional information about the measurement setup that may influence details of specific algorithms.
The calibration information may be set for an instrument device that has been connected. All processing contexts that are created afterwards are
The calibration information may be set for a measurement that is being created. The information will be stored if the measurement is saved.
If a measurement includes stored calibration information, if a processing context is created to
When creating a manual processing context the user may specify calibration information manually.
Creating a new Calibration Information Structure
The following example shows how to create a calibration information structure and how to set specific calibration values:
1 try {
2 fluxEngine::CalibrationInfo calibrationInfo;
3
4 // Indicate that the pixel resolution of the object
5 // imaged is 1mm per pixel:
6 calibrationInfo.setSetting(fluxEngine::CalibrationSettingType::PixelSizeX,
7 1.0, "mm");
8 // Indicate the camera is 30cm away from the object
9 // being image
10 calibrationInfo.setSetting(fluxEngine::CalibrationSettingType::InstrumentBaseDistance,
11 30.0, "cm");
12 // Indicate that the instrument is positioned at an
13 // angle of 1.5 degrees
14 calibrationInfo.setSetting(fluxEngine::CalibrationSettingType::InstrumentAngleX,
15 1.5, "deg");
16
17 // Specify a white reference material
18 std::vector<double> const whiteRef_lambda{400.0, 500.0, 600.0, 700.0, 800.0, 900.0};
19 std::vector<double> const whiteRef_R{0.99, 0.99, 0.99, 0.99, 0.99, 0.98};
20 calibrationInfo.setWhiteReferenceReflectivity(whiteRef_lambda, whiteRef_R, "nm");
21 } catch (std::exception& e) {
22 std::cerr << "An error occurred: " << e.what() << std::endl;
23 exit(1);
24 }
Using the Calibration Information for Device Processing Contexts
The following example shows how the calibration information that was mentioned beforehand may be used to create device processing contexts:
1 // From before:
2 fluxEngine::CalibrationInfo calibrationInfo = ...;
3 fluxEngine::InstrumentDevice* camera = ...;
4 fluxEngine::Model model = ...;
5 fluxEngine::InstrumentParameters parameters = ...;
6 try {
7 using fluxEngine::ProcessingContext;
8 ProcessingContext ctx1 =
9 ProcessingContext::createInstrumentProcessingContext(camera, model, parameters);
10
11 camera->setCalibrationInfo(calibrationInfo);
12
13 ProcessingContext ctx2 =
14 ProcessingContext::createInstrumentProcessingContext(camera, model, parameters);
15
16 // ctx1 will use the old calibration information
17 // (if any at all), while ctx2 will use the
18 // calibration information stored in calibrationInfo.
19 } catch (std::exception& e) {
20 std::cerr << "An error occurred: " << e.what() << std::endl;
21 exit(1);
22 }
Note
Calibration Information currently has no effect on preview processing contexts (and likely never will). It does have an effect on recording processing contexts though. For example, if a white reference reflectivity curve is specified, and the recording is to take place in reflectances, that curve will be considered when calculating reflectance values.
Also, the
fluxEngine::ProcessingContext::HSIRecordingResult
structure will contain the calibration information structure that
will be valid for the recording if it were to be stored.
Important: the calibration information may be different than
the supplied calibration information. For example, if software
binning is enabled, the raw calibration information that must be
supplied to the instrument device by the user must be for the
raw pixels of the sensor, while the calibration information stored
in the
fluxEngine::ProcessingContext::HSIRecordingResult
structure will have been adjusted for the binning factor, because
a binned pixel will cover a larger part of the object than the
unbinned (raw) pixel. There are other ways in which the
preprocessing that is performed may have an influence, and
fluxEngine ensures that this is handled properly.