libvisiontransfer  6.4.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 
22 namespace visiontransfer {
23 
37 class VT_EXPORT SceneScanParameters {
38 public:
46  SceneScanParameters(const DeviceInfo& device);
47 
57  SceneScanParameters(const char* address, const char* service = "7683");
58 
60 
61  // Processing settings
62 
68  PASS_THROUGH = 0,
69 
71  RECTIFY = 1,
72 
74  STEREO_MATCHING = 2
75  };
76 
84  return static_cast<OperationMode>(readIntParameter(internal::StandardParameterIDs::OPERATION_MODE));
85  }
86 
94  writeIntParameter(internal::StandardParameterIDs::OPERATION_MODE, static_cast<int>(mode));
95  }
96 
101  return readIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET);
102  }
103 
109  void setDisparityOffset(int offset) {
110  writeIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET, offset);
111  }
112 
113  // Algorithmic settings
114 
119  return readIntParameter(internal::StandardParameterIDs::SGM_P1);
120  }
121 
127  void setStereoMatchingP1(int p1) {
128  writeIntParameter(internal::StandardParameterIDs::SGM_P1, p1);
129  }
130 
135  return readIntParameter(internal::StandardParameterIDs::SGM_P2);
136  }
137 
143  void setStereoMatchingP2(int p2) {
144  writeIntParameter(internal::StandardParameterIDs::SGM_P2, p2);
145  }
146 
152  return readBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED);
153  }
154 
159  void setMaskBorderPixelsEnabled(bool enabled) {
160  writeBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED, enabled);
161  }
162 
167  return readBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED);
168  }
169 
173  void setConsistencyCheckEnabled(bool enabled) {
174  writeBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED, enabled);
175  }
176 
181  return readIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY);
182  }
183 
189  void setConsistencyCheckSensitivity(int sensitivity) {
190  writeIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY, sensitivity);
191  }
192 
197  return readBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED);
198  }
199 
203  void setUniquenessCheckEnabled(bool enabled) {
204  writeBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED, enabled);
205  }
206 
211  return readIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY);
212  }
213 
219  void setUniquenessCheckSensitivity(int sensitivity) {
220  writeIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY, sensitivity);
221  }
222 
227  return readBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED);
228  }
229 
233  void setTextureFilterEnabled(bool enabled) {
234  writeBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED, enabled);
235  }
236 
241  return readIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY);
242  }
243 
249  void setTextureFilterSensitivity(int sensitivity) {
250  writeIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY, sensitivity);
251  }
252 
257  return readBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED);
258  }
259 
263  void setGapInterpolationEnabled(bool enabled) {
264  writeBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED, enabled);
265  }
266 
271  return readBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED);
272  }
273 
277  void setNoiseReductionEnabled(bool enabled) {
278  writeBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED, enabled);
279  }
280 
285  return readBoolParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ENABLED);
286  }
287 
291  void setSpeckleFilterEnabled(bool enabled) {
292  writeBoolParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ENABLED, enabled);
293  }
294 
295  // Exposure and gain settings
296 
300  enum AutoMode {
302  AUTO_EXPOSURE_AND_GAIN = 0,
303 
305  AUTO_EXPOSURE_MANUAL_GAIN = 1,
306 
308  MANUAL_EXPOSORE_AUTO_GAIN = 2,
309 
311  MANUAL_EXPOSURE_MANUAL_GAIN = 3
312  };
313 
319  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE));
320  }
321 
326  void setAutoMode(AutoMode mode) {
327  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE, static_cast<int>(mode));
328  }
329 
338  return readDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY);
339  }
340 
348  void setAutoTargetIntensity(double intensity) {
349  writeDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY, intensity);
350  }
351 
360  return readDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA);
361  }
362 
370  void setAutoIntensityDelta(double delta) {
371  writeDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA, delta);
372  }
373 
378  enum TargetFrame {
380  LEFT_FRAME = 0,
381 
383  RIGHT_FRAME = 1,
384 
386  BOTH_FRAMES = 2,
387  };
388 
394  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME));
395  }
396 
402  writeIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME, static_cast<int>(target));
403  }
404 
413  return readIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES);
414  }
415 
423  void setAutoSkippedFrames(int skipped) {
424  writeIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES, skipped);
425  }
426 
432  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME);
433  }
434 
439  void setAutoMaxExposureTime(double time) {
440  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME, time);
441  }
442 
447  double getAutoMaxGain() {
448  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN);
449  }
450 
455  void setAutoMaxGain(double gain) {
456  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN, gain);
457  }
458 
469  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME);
470  }
471 
481  void setManualExposureTime(double time) {
482  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME, time);
483  }
484 
494  double getManualGain() {
495  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN);
496  }
497 
507  void setManualGain(double gain) {
508  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN, gain);
509  }
510 
515  return readBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED);
516  }
517 
521  void setAutoROIEnabled(bool enabled) {
522  writeBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED, enabled);
523  }
524 
538  void getAutoROI(int& x, int& y, int& width, int& height) {
539  x = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X);
540  y = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y);
541  width = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH);
542  height = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT);
543  }
544 
558  void setAutoROI(int x, int y, int width, int height) {
559  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X, x);
560  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y, y);
561  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH, width);
562  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT, height);
563  }
564 
565  // Trigger and pairing settings
566 
573  return readIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS);
574  }
575 
581  void setMaxFrameTimeDifference(int diffMs) {
582  writeIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS, diffMs);
583  }
584 
590  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY);
591  }
592 
597  void setTriggerFrequency(double freq) {
598  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY, freq);
599  }
600 
605  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED);
606  }
607 
611  void setTrigger0Enabled(bool enabled) {
612  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED, enabled);
613  }
614 
619  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED);
620  }
621 
625  void setTrigger1Enabled(bool enabled) {
626  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED, enabled);
627  }
628 
634  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH);
635  }
636 
641  void setTrigger0PulseWidth(double width) {
642  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH, width);
643  }
644 
650  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH);
651  }
652 
657  void setTrigger1PulseWidth(double width) {
658  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH, width);
659  }
660 
665  double getTrigger1Offset() {
666  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET);
667  }
668 
673  void setTrigger1Offset(double offset) {
674  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET, offset);
675  }
676 
677  // Auto calibration parameters
678 
683  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED);
684  }
685 
689  void setAutoRecalibrationEnabled(bool enabled) {
690  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED, enabled);
691  }
692 
697  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT);
698  }
699 
703  void setSaveAutoReclabration(bool save) {
704  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT, save);
705  }
706 
707 private:
708  // We (mostly) follow the pimpl idiom here
709  class Pimpl;
710  Pimpl* pimpl;
711 
712  // This class cannot be copied
714  SceneScanParameters& operator=(const SceneScanParameters& other);
715 
716  // Generic functions for reading parameters
717  int readIntParameter(int id);
718  double readDoubleParameter(int id);
719  bool readBoolParameter(int id);
720 
721  // Generic functions for writing parameters
722  void writeIntParameter(int id, int value);
723  void writeDoubleParameter(int id, double value);
724  void writeBoolParameter(int id, bool value);
725 };
726 
727 } // namespace
728 
729 #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 setStereoMatchingP1(int p1)
Sets the SGM penalty P1 for small disparity changes.
void setAutoROI(int x, int y, int width, int height)
Sets the configured ROI for automatic exposure and gain control.
int getStereoMatchingP2()
Gets the SGM penalty P2 for large disparity changes.
void setAutoMaxGain(double gain)
Gets the maximum gain that can be selected automatically.
bool getGapInterpolationEnabled()
Returns true if the texture gap interpolation is enabled.
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.
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.
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.
bool getSpeckleFilterEnabled()
Returns true if the speckle filter is enabled.
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.
bool getSaveAutoReclabration()
Returns true if persistent storage of auto re-calibration results is enabled.
TargetFrame
Possible options for the target frame selection of the automatic exposure and gain control...
int getStereoMatchingP1()
Gets the SGM penalty P1 for small disparity changes.
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.
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 setAutoTargetIntensity(double intensity)
Sets the target image intensity of the automatic exposure and gain control.
AutoMode getAutoMode()
Gets the current mode of the automatic exposure and gain control.
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.
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.
void setConsistencyCheckEnabled(bool enabled)
Enables or disables the consistency check.
Aggregates information about a discovered device.
Definition: deviceinfo.h:25
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 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 setSaveAutoReclabration(bool save)
Enables or disables persistent storage of auto re-calibration results.
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.
void setSpeckleFilterEnabled(bool enabled)
Enables or disables the speckle filter.
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.
void setStereoMatchingP2(int p2)
Sets the SGM penalty P2 for large disparity changes.
bool getTrigger0Enabled()
Returns true if trigger signal 0 is enabled.
Nerian Vision Technologies