libvisiontransfer  7.1.0
scenescanparameters.h
1 /*******************************************************************************
2  * Copyright (c) 2019 Nerian Vision GmbH
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *******************************************************************************/
14 
15 #ifndef VISIONTRANSFER_SCENESCANPARAMETERS_H
16 #define VISIONTRANSFER_SCENESCANPARAMETERS_H
17 
18 #include "visiontransfer/common.h"
19 #include "visiontransfer/deviceinfo.h"
20 #include "visiontransfer/standardparameterids.h"
21 #include "visiontransfer/parameterinfo.h"
22 
23 #include <map>
24 
25 namespace visiontransfer {
26 
46 class VT_EXPORT SceneScanParameters {
47 public:
55  SceneScanParameters(const DeviceInfo& device);
56 
66  SceneScanParameters(const char* address, const char* service = "7683");
67 
69 
70  // Processing settings
71 
77  PASS_THROUGH = 0,
78 
80  RECTIFY = 1,
81 
83  STEREO_MATCHING = 2
84  };
85 
93  return static_cast<OperationMode>(readIntParameter(internal::StandardParameterIDs::OPERATION_MODE));
94  }
95 
103  writeIntParameter(internal::StandardParameterIDs::OPERATION_MODE, static_cast<int>(mode));
104  }
105 
110  return readIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET);
111  }
112 
118  void setDisparityOffset(int offset) {
119  writeIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET, offset);
120  }
121 
122  // Algorithmic settings
123 
128  return readIntParameter(internal::StandardParameterIDs::SGM_P1_EDGE);
129  }
130 
136  void setStereoMatchingP1Edge(int p1) {
137  writeIntParameter(internal::StandardParameterIDs::SGM_P1_EDGE, p1);
138  }
139 
144  return readIntParameter(internal::StandardParameterIDs::SGM_P1_NO_EDGE);
145  }
146 
153  writeIntParameter(internal::StandardParameterIDs::SGM_P1_NO_EDGE, p1);
154  }
155 
160  return readIntParameter(internal::StandardParameterIDs::SGM_P2_EDGE);
161  }
162 
168  void setStereoMatchingP2Edge(int p2) {
169  writeIntParameter(internal::StandardParameterIDs::SGM_P2_EDGE, p2);
170  }
171 
176  return readIntParameter(internal::StandardParameterIDs::SGM_P2_NO_EDGE);
177  }
178 
185  writeIntParameter(internal::StandardParameterIDs::SGM_P2_NO_EDGE, p2);
186  }
187 
192  return readIntParameter(internal::StandardParameterIDs::SGM_EDGE_SENSITIVITY);
193  }
194 
200  void setStereoMatchingEdgeSensitivity(int sensitivity) {
201  writeIntParameter(internal::StandardParameterIDs::SGM_EDGE_SENSITIVITY, sensitivity);
202  }
203 
209  return readBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED);
210  }
211 
216  void setMaskBorderPixelsEnabled(bool enabled) {
217  writeBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED, enabled);
218  }
219 
224  return readBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED);
225  }
226 
230  void setConsistencyCheckEnabled(bool enabled) {
231  writeBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED, enabled);
232  }
233 
238  return readIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY);
239  }
240 
246  void setConsistencyCheckSensitivity(int sensitivity) {
247  writeIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY, sensitivity);
248  }
249 
254  return readBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED);
255  }
256 
260  void setUniquenessCheckEnabled(bool enabled) {
261  writeBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED, enabled);
262  }
263 
268  return readIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY);
269  }
270 
276  void setUniquenessCheckSensitivity(int sensitivity) {
277  writeIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY, sensitivity);
278  }
279 
284  return readBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED);
285  }
286 
290  void setTextureFilterEnabled(bool enabled) {
291  writeBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED, enabled);
292  }
293 
298  return readIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY);
299  }
300 
306  void setTextureFilterSensitivity(int sensitivity) {
307  writeIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY, sensitivity);
308  }
309 
314  return readBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED);
315  }
316 
320  void setGapInterpolationEnabled(bool enabled) {
321  writeBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED, enabled);
322  }
323 
328  return readBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED);
329  }
330 
334  void setNoiseReductionEnabled(bool enabled) {
335  writeBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED, enabled);
336  }
337 
342  return readIntParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ITERATIONS);
343  }
344 
348  void setSpeckleFilterIterations(int iter) {
349  writeIntParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ITERATIONS, iter);
350  }
351 
352  // Exposure and gain settings
353 
357  enum AutoMode {
359  AUTO_EXPOSURE_AND_GAIN = 0,
360 
362  AUTO_EXPOSURE_MANUAL_GAIN = 1,
363 
365  MANUAL_EXPOSORE_AUTO_GAIN = 2,
366 
368  MANUAL_EXPOSURE_MANUAL_GAIN = 3
369  };
370 
376  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE));
377  }
378 
383  void setAutoMode(AutoMode mode) {
384  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE, static_cast<int>(mode));
385  }
386 
395  return readDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY);
396  }
397 
405  void setAutoTargetIntensity(double intensity) {
406  writeDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY, intensity);
407  }
408 
417  return readDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA);
418  }
419 
427  void setAutoIntensityDelta(double delta) {
428  writeDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA, delta);
429  }
430 
435  enum TargetFrame {
437  LEFT_FRAME = 0,
438 
440  RIGHT_FRAME = 1,
441 
443  BOTH_FRAMES = 2,
444  };
445 
451  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME));
452  }
453 
459  writeIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME, static_cast<int>(target));
460  }
461 
470  return readIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES);
471  }
472 
480  void setAutoSkippedFrames(int skipped) {
481  writeIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES, skipped);
482  }
483 
489  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME);
490  }
491 
496  void setAutoMaxExposureTime(double time) {
497  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME, time);
498  }
499 
504  double getAutoMaxGain() {
505  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN);
506  }
507 
512  void setAutoMaxGain(double gain) {
513  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN, gain);
514  }
515 
526  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME);
527  }
528 
538  void setManualExposureTime(double time) {
539  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME, time);
540  }
541 
551  double getManualGain() {
552  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN);
553  }
554 
564  void setManualGain(double gain) {
565  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN, gain);
566  }
567 
572  return readBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED);
573  }
574 
578  void setAutoROIEnabled(bool enabled) {
579  writeBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED, enabled);
580  }
581 
595  void getAutoROI(int& x, int& y, int& width, int& height) {
596  x = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X);
597  y = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y);
598  width = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH);
599  height = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT);
600  }
601 
615  void setAutoROI(int x, int y, int width, int height) {
616  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X, x);
617  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y, y);
618  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH, width);
619  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT, height);
620  }
621 
622  // Trigger and pairing settings
623 
630  return readIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS);
631  }
632 
638  void setMaxFrameTimeDifference(int diffMs) {
639  writeIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS, diffMs);
640  }
641 
647  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY);
648  }
649 
654  void setTriggerFrequency(double freq) {
655  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY, freq);
656  }
657 
662  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED);
663  }
664 
668  void setTrigger0Enabled(bool enabled) {
669  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED, enabled);
670  }
671 
676  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED);
677  }
678 
682  void setTrigger1Enabled(bool enabled) {
683  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED, enabled);
684  }
685 
691  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH);
692  }
693 
698  void setTrigger0PulseWidth(double width) {
699  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH, width);
700  }
701 
707  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH);
708  }
709 
714  void setTrigger1PulseWidth(double width) {
715  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH, width);
716  }
717 
722  double getTrigger1Offset() {
723  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET);
724  }
725 
730  void setTrigger1Offset(double offset) {
731  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET, offset);
732  }
733 
734  // Auto calibration parameters
735 
740  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED);
741  }
742 
746  void setAutoRecalibrationEnabled(bool enabled) {
747  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED, enabled);
748  }
749 
754  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT);
755  }
756 
760  void setSaveAutoRecalibration(bool save) {
761  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT, save);
762  }
763 
769  return readBoolParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_ENABLED);
770  }
771 
777  writeBoolParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_ENABLED, enabled);
778  }
779 
793  void getSubpixelOptimizationROI(int& x, int& y, int& width, int& height) {
794  x = readIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_X);
795  y = readIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_Y);
796  width = readIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_WIDTH);
797  height = readIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_HEIGHT);
798  }
799 
813  void setSubpixelOptimizationROI(int x, int y, int width, int height) {
814  writeIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_X, x);
815  writeIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_Y, y);
816  writeIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_WIDTH, width);
817  writeIntParameter(internal::StandardParameterIDs::SUBPIXEL_OPTIMIZATION_ROI_HEIGHT, height);
818  }
819 
824  std::map<std::string, ParameterInfo> getAllParameters();
825 
829  template<typename T>
830  void setNamedParameter(const std::string& name, T value);
831 
835  template<typename T>
836  T getNamedParameter(const std::string& name);
837 
838 private:
839  // We (mostly) follow the pimpl idiom here
840  class Pimpl;
841  Pimpl* pimpl;
842 
843  // This class cannot be copied
845  SceneScanParameters& operator=(const SceneScanParameters& other);
846 
847  // Generic functions for reading parameters
848  int readIntParameter(int id);
849  double readDoubleParameter(int id);
850  bool readBoolParameter(int id);
851 
852  // Generic functions for writing parameters
853  void writeIntParameter(int id, int value);
854  void writeDoubleParameter(int id, double value);
855  void writeBoolParameter(int id, bool value);
856 
857 };
858 
859 } // namespace
860 
861 #endif
void setDisparityOffset(int offset)
Sets the offset of the evaluated disparity range.
void setAutoIntensityDelta(double delta)
Sets the minimum intensity change that is required for adjusting the camera settings.
void getAutoROI(int &x, int &y, int &width, int &height)
Gets the configured ROI for automatic exposure and gain control.
bool getAutoRecalibrationEnabled()
Returns true if auto re-calibration is enabled.
bool getAutoROIEnabled()
Returns true if an ROI for automatic exposure and gain control is enabled.
bool getTextureFilterEnabled()
Returns true if the texture filter is enabled.
void setAutoROI(int x, int y, int width, int height)
Sets the configured ROI for automatic exposure and gain control.
void setAutoMaxGain(double gain)
Gets the maximum gain that can be selected automatically.
bool getSubpixelOptimizationROIEnabled()
Returns true if an ROI for the subpixel optimization algorithm is enabled (otherwise complete frames ...
bool getGapInterpolationEnabled()
Returns true if the texture gap interpolation is enabled.
void setStereoMatchingEdgeSensitivity(int sensitivity)
Sets the edge sensitivity of the SGM algorithm.
double getAutoMaxGain()
Gets the maximum gain that can be selected automatically.
double getTriggerFrequency()
Gets the frequency of the trigger signal.
void setManualExposureTime(double time)
Sets the manually selected exposure time.
void setAutoMaxExposureTime(double time)
Sets the maximum exposure time that can be selected automatically.
void setSpeckleFilterIterations(int iter)
Enables or disables the speckle filter.
bool getMaskBorderPixelsEnabled()
Returns true if border pixels are removed from the computed disparity map.
void setUniquenessCheckSensitivity(int sensitivity)
Sets a new sensitivity value for the uniqueness check.
void setStereoMatchingP2NoEdge(int p2)
Sets the SGM penalty P2 for large disparity changes at image edges.
double getTrigger0PulseWidth()
Gets the pulse width of trigger signal 0.
void setAutoRecalibrationEnabled(bool enabled)
Enables or disables auto-recalibration.
double getAutoMaxExposureTime()
Gets the maximum exposure time that can be selected automatically.
double getAutoTargetIntensity()
Gets the target image intensity of the automatic exposure and gain control.
int getMaxFrameTimeDifference()
Gets the maximum allowed time difference between two corresponding frames.
void setTrigger0Enabled(bool enabled)
Enables or disables trigger signal 0.
void setNoiseReductionEnabled(bool enabled)
Enables or disables the noise reduction filter.
TargetFrame
Possible options for the target frame selection of the automatic exposure and gain control...
double getTrigger1PulseWidth()
Gets the pulse width of trigger signal 1.
void setManualGain(double gain)
Sets the manually selected gain.
OperationMode getOperationMode()
Gets the current operation mode.
int getStereoMatchingP2NoEdge()
Gets the SGM penalty P2 for large disparity changes at image edges.
void setSubpixelOptimizationROI(int x, int y, int width, int height)
Sets the configured ROI for the subpixel optimization algorithm.
void setMaxFrameTimeDifference(int diffMs)
Sets the maximum allowed time difference between two corresponding frames.
void setAutoSkippedFrames(int skipped)
Sets the current interval at which the automatic exposure and gain control is run.
void setSaveAutoRecalibration(bool save)
Enables or disables persistent storage of auto re-calibration results.
void setAutoTargetIntensity(double intensity)
Sets the target image intensity of the automatic exposure and gain control.
int getStereoMatchingP2Edge()
Gets the SGM penalty P2 for large disparity changes at image edges.
void setStereoMatchingP1NoEdge(int p1)
Sets the SGM penalty P1 for small disparity changes outside image edges.
AutoMode getAutoMode()
Gets the current mode of the automatic exposure and gain control.
void getSubpixelOptimizationROI(int &x, int &y, int &width, int &height)
Gets the configured ROI for the subpixel optimization algorithm.
int getStereoMatchingP1Edge()
Gets the SGM penalty P1 for small disparity changes at image edges.
bool getNoiseReductionEnabled()
Returns true if the noise reduction filter is enabled.
int getUniquenessCheckSensitivity()
Gets the current sensitivity value for the uniqueness check.
int getAutoSkippedFrames()
Gets the current interval at which the automatic exposure and gain control is run.
void setTrigger0PulseWidth(double width)
Sets the pulse width of trigger signal 0.
OperationMode
Operation modes supported by SceneScan.
AutoMode getAutoTargetFrame()
Gets the selected target frame for automatic exposure and gain control.
void setMaskBorderPixelsEnabled(bool enabled)
Enables or disables the removal of border pixels from the computed disparity map. ...
int getTextureFilterSensitivity()
Gets the current sensitivity value for the texture filter.
bool getSaveAutoRecalibration()
Returns true if persistent storage of auto re-calibration results is enabled.
Allows a configuration of SceneScan&#39;s parameters through a network connection.
void setTextureFilterSensitivity(int sensitivity)
Sets a new sensitivity value for the texture filter.
void setAutoROIEnabled(bool enabled)
Enables or disables an ROI for automatic exposure and gain control.
void setTrigger1PulseWidth(double width)
Sets the pulse width of trigger signal 1.
void setUniquenessCheckEnabled(bool enabled)
Enables or disables the uniqueness check.
int getStereoMatchingEdgeSensitivity()
Gets the edge sensitivity of the SGM algorithm.
void setSubpixelOptimizationROIEnabled(bool enabled)
Enables or disables an ROI for the subpixel optimization algorithm. (if disabled, complete frames are...
int getSpeckleFilterIterations()
Returns true if the speckle filter is enabled.
void setConsistencyCheckEnabled(bool enabled)
Enables or disables the consistency check.
Aggregates information about a discovered device.
Definition: deviceinfo.h:47
void setTextureFilterEnabled(bool enabled)
Enables or disables the texture filter.
int getConsistencyCheckSensitivity()
Gets the current sensitivity value for the consistency check.
void setTriggerFrequency(double freq)
Sets the frequency of the trigger signal.
void setTrigger1Enabled(bool enabled)
Enables or disables trigger signal 1.
void setStereoMatchingP2Edge(int p2)
Sets the SGM penalty P2 for large disparity changes at image edges.
void setStereoMatchingP1Edge(int p1)
Sets the SGM penalty P1 for small disparity changes at image edges.
void setConsistencyCheckSensitivity(int sensitivity)
Sets a new sensitivity value for the consistency check.
void setAutoTargetFrame(TargetFrame target)
Selects the target frame for automatic exposure and gain control.
double getManualGain()
Gets the manually selected gain.
int getDisparityOffset()
Gets the current offset of the evaluated disparity range.
double getAutoIntensityDelta()
Gets the minimum intensity change that is required for adjusting the camera settings.
void setGapInterpolationEnabled(bool enabled)
Enables or disables the gap interpolation.
bool getUniquenessCheckEnabled()
Returns true if the consistency check is enabled.
AutoMode
Possible modes of the automatic exposure and gain control.
bool getTrigger1Enabled()
Returns true if trigger signal 1 is enabled.
void setTrigger1Offset(double offset)
Sets the time offset between trigger signal 1 and signal 0.
void setAutoMode(AutoMode mode)
Sets the current mode of the automatic exposure and gain control.
double getTrigger1Offset()
Gets the time offset between trigger signal 1 and signal 0.
int getStereoMatchingP1NoEdge()
Gets the SGM penalty P1 for small disparity changes outside image edges.
double getManualExposureTime()
Gets the manually selected exposure time.
bool getConsistencyCheckEnabled()
Returns true if the consistency check is enabled.
void setOperationMode(OperationMode mode)
Configures the device to a new operation mode.
bool getTrigger0Enabled()
Returns true if trigger signal 0 is enabled.
Nerian Vision Technologies