libvisiontransfer  6.5.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 
40 class VT_EXPORT SceneScanParameters {
41 public:
49  SceneScanParameters(const DeviceInfo& device);
50 
60  SceneScanParameters(const char* address, const char* service = "7683");
61 
63 
64  // Processing settings
65 
71  PASS_THROUGH = 0,
72 
74  RECTIFY = 1,
75 
77  STEREO_MATCHING = 2
78  };
79 
87  return static_cast<OperationMode>(readIntParameter(internal::StandardParameterIDs::OPERATION_MODE));
88  }
89 
97  writeIntParameter(internal::StandardParameterIDs::OPERATION_MODE, static_cast<int>(mode));
98  }
99 
104  return readIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET);
105  }
106 
112  void setDisparityOffset(int offset) {
113  writeIntParameter(internal::StandardParameterIDs::DISPARITY_OFFSET, offset);
114  }
115 
116  // Algorithmic settings
117 
122  return readIntParameter(internal::StandardParameterIDs::SGM_P1);
123  }
124 
130  void setStereoMatchingP1(int p1) {
131  writeIntParameter(internal::StandardParameterIDs::SGM_P1, p1);
132  }
133 
138  return readIntParameter(internal::StandardParameterIDs::SGM_P2);
139  }
140 
146  void setStereoMatchingP2(int p2) {
147  writeIntParameter(internal::StandardParameterIDs::SGM_P2, p2);
148  }
149 
155  return readBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED);
156  }
157 
162  void setMaskBorderPixelsEnabled(bool enabled) {
163  writeBoolParameter(internal::StandardParameterIDs::MASK_BORDER_PIXELS_ENABLED, enabled);
164  }
165 
170  return readBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED);
171  }
172 
176  void setConsistencyCheckEnabled(bool enabled) {
177  writeBoolParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_ENABLED, enabled);
178  }
179 
184  return readIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY);
185  }
186 
192  void setConsistencyCheckSensitivity(int sensitivity) {
193  writeIntParameter(internal::StandardParameterIDs::CONSISTENCY_CHECK_SENSITIVITY, sensitivity);
194  }
195 
200  return readBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED);
201  }
202 
206  void setUniquenessCheckEnabled(bool enabled) {
207  writeBoolParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_ENABLED, enabled);
208  }
209 
214  return readIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY);
215  }
216 
222  void setUniquenessCheckSensitivity(int sensitivity) {
223  writeIntParameter(internal::StandardParameterIDs::UNIQUENESS_CHECK_SENSITIVITY, sensitivity);
224  }
225 
230  return readBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED);
231  }
232 
236  void setTextureFilterEnabled(bool enabled) {
237  writeBoolParameter(internal::StandardParameterIDs::TEXTURE_FILTER_ENABLED, enabled);
238  }
239 
244  return readIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY);
245  }
246 
252  void setTextureFilterSensitivity(int sensitivity) {
253  writeIntParameter(internal::StandardParameterIDs::TEXTURE_FILTER_SENSITIVITY, sensitivity);
254  }
255 
260  return readBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED);
261  }
262 
266  void setGapInterpolationEnabled(bool enabled) {
267  writeBoolParameter(internal::StandardParameterIDs::GAP_INTERPOLATION_ENABLED, enabled);
268  }
269 
274  return readBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED);
275  }
276 
280  void setNoiseReductionEnabled(bool enabled) {
281  writeBoolParameter(internal::StandardParameterIDs::NOISE_REDUCTION_ENABLED, enabled);
282  }
283 
288  return readIntParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ITERATIONS);
289  }
290 
294  void setSpeckleFilterIterations(int iter) {
295  writeIntParameter(internal::StandardParameterIDs::SPECKLE_FILTER_ITERATIONS, iter);
296  }
297 
298  // Exposure and gain settings
299 
303  enum AutoMode {
305  AUTO_EXPOSURE_AND_GAIN = 0,
306 
308  AUTO_EXPOSURE_MANUAL_GAIN = 1,
309 
311  MANUAL_EXPOSORE_AUTO_GAIN = 2,
312 
314  MANUAL_EXPOSURE_MANUAL_GAIN = 3
315  };
316 
322  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE));
323  }
324 
329  void setAutoMode(AutoMode mode) {
330  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_MODE, static_cast<int>(mode));
331  }
332 
341  return readDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY);
342  }
343 
351  void setAutoTargetIntensity(double intensity) {
352  writeDoubleParameter(internal::StandardParameterIDs::AUTO_TARGET_INTENSITY, intensity);
353  }
354 
363  return readDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA);
364  }
365 
373  void setAutoIntensityDelta(double delta) {
374  writeDoubleParameter(internal::StandardParameterIDs::AUTO_INTENSITY_DELTA, delta);
375  }
376 
381  enum TargetFrame {
383  LEFT_FRAME = 0,
384 
386  RIGHT_FRAME = 1,
387 
389  BOTH_FRAMES = 2,
390  };
391 
397  return static_cast<AutoMode>(readIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME));
398  }
399 
405  writeIntParameter(internal::StandardParameterIDs::AUTO_TARGET_FRAME, static_cast<int>(target));
406  }
407 
416  return readIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES);
417  }
418 
426  void setAutoSkippedFrames(int skipped) {
427  writeIntParameter(internal::StandardParameterIDs::AUTO_SKIPPED_FRAMES, skipped);
428  }
429 
435  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME);
436  }
437 
442  void setAutoMaxExposureTime(double time) {
443  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_EXPOSURE_TIME, time);
444  }
445 
450  double getAutoMaxGain() {
451  return readDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN);
452  }
453 
458  void setAutoMaxGain(double gain) {
459  writeDoubleParameter(internal::StandardParameterIDs::AUTO_MAXIMUM_GAIN, gain);
460  }
461 
472  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME);
473  }
474 
484  void setManualExposureTime(double time) {
485  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_EXPOSURE_TIME, time);
486  }
487 
497  double getManualGain() {
498  return readDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN);
499  }
500 
510  void setManualGain(double gain) {
511  writeDoubleParameter(internal::StandardParameterIDs::MANUAL_GAIN, gain);
512  }
513 
518  return readBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED);
519  }
520 
524  void setAutoROIEnabled(bool enabled) {
525  writeBoolParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_ENABLED, enabled);
526  }
527 
541  void getAutoROI(int& x, int& y, int& width, int& height) {
542  x = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X);
543  y = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y);
544  width = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH);
545  height = readIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT);
546  }
547 
561  void setAutoROI(int x, int y, int width, int height) {
562  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_X, x);
563  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_Y, y);
564  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_WIDTH, width);
565  writeIntParameter(internal::StandardParameterIDs::AUTO_EXPOSURE_ROI_HEIGHT, height);
566  }
567 
568  // Trigger and pairing settings
569 
576  return readIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS);
577  }
578 
584  void setMaxFrameTimeDifference(int diffMs) {
585  writeIntParameter(internal::StandardParameterIDs::MAX_FRAME_TIME_DIFFERENCE_MS, diffMs);
586  }
587 
593  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY);
594  }
595 
600  void setTriggerFrequency(double freq) {
601  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_FREQUENCY, freq);
602  }
603 
608  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED);
609  }
610 
614  void setTrigger0Enabled(bool enabled) {
615  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_0_ENABLED, enabled);
616  }
617 
622  return readBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED);
623  }
624 
628  void setTrigger1Enabled(bool enabled) {
629  writeBoolParameter(internal::StandardParameterIDs::TRIGGER_1_ENABLED, enabled);
630  }
631 
637  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH);
638  }
639 
644  void setTrigger0PulseWidth(double width) {
645  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_0_PULSE_WIDTH, width);
646  }
647 
653  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH);
654  }
655 
660  void setTrigger1PulseWidth(double width) {
661  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_PULSE_WIDTH, width);
662  }
663 
668  double getTrigger1Offset() {
669  return readDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET);
670  }
671 
676  void setTrigger1Offset(double offset) {
677  writeDoubleParameter(internal::StandardParameterIDs::TRIGGER_1_OFFSET, offset);
678  }
679 
680  // Auto calibration parameters
681 
686  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED);
687  }
688 
692  void setAutoRecalibrationEnabled(bool enabled) {
693  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_ENABLED, enabled);
694  }
695 
700  return readBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT);
701  }
702 
706  void setSaveAutoReclabration(bool save) {
707  writeBoolParameter(internal::StandardParameterIDs::AUTO_RECALIBRATION_PERMANENT, save);
708  }
709 
714  std::map<std::string, ParameterInfo> getAllParameters();
715 
719  template<typename T>
720  void setNamedParameter(const std::string& name, T value);
721 
725  template<typename T>
726  T getNamedParameter(const std::string& name);
727 
728 private:
729  // We (mostly) follow the pimpl idiom here
730  class Pimpl;
731  Pimpl* pimpl;
732 
733  // This class cannot be copied
735  SceneScanParameters& operator=(const SceneScanParameters& other);
736 
737  // Generic functions for reading parameters
738  int readIntParameter(int id);
739  double readDoubleParameter(int id);
740  bool readBoolParameter(int id);
741 
742  // Generic functions for writing parameters
743  void writeIntParameter(int id, int value);
744  void writeDoubleParameter(int id, double value);
745  void writeBoolParameter(int id, bool value);
746 
747 };
748 
749 } // namespace
750 
751 #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.
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.
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.
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.
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: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.
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