CameraMyntEye: added setIrControl()

This commit is contained in:
matlabbe
2020-05-31 12:17:14 -04:00
parent 415a2778f1
commit d5cfd8013d
4 changed files with 73 additions and 16 deletions

View File

@@ -61,7 +61,9 @@ public:
virtual bool odomProvided() const { return false; } virtual bool odomProvided() const { return false; }
void publishInterIMU(bool enabled); void publishInterIMU(bool enabled);
void setAutoExposure(bool enabled, int manualGain=24, int manualBrightness=120, int manualConstrast=116); void setAutoExposure();
void setManualExposure(int gain=24, int brightness=120, int constrast=116);
void setIrControl(int value);
protected: protected:
/** /**
@@ -85,6 +87,7 @@ private:
int gain_; int gain_;
int brightness_; int brightness_;
int contrast_; int contrast_;
int irControl_;
USemaphore dataReady_; USemaphore dataReady_;
UMutex dataMutex_; UMutex dataMutex_;
cv::Mat leftFrameBuffer_; cv::Mat leftFrameBuffer_;

View File

@@ -154,13 +154,31 @@ void CameraMyntEye::publishInterIMU(bool enabled)
#endif #endif
} }
void CameraMyntEye::setAutoExposure(bool enabled, int manualGain, int manualBrightness, int manualConstrast) void CameraMyntEye::setAutoExposure()
{ {
#ifdef RTABMAP_MYNTEYE #ifdef RTABMAP_MYNTEYE
autoExposure_ = enabled; autoExposure_ = true;
gain_ = manualGain; #endif
brightness_ = manualBrightness; }
contrast_ = manualConstrast;
void CameraMyntEye::setManualExposure(int gain, int brightness, int constrast)
{
#ifdef RTABMAP_MYNTEYE
UASSERT(gain>=0 && gain<=48);
UASSERT(brightness>=0 && brightness<=240);
UASSERT(constrast>=0 && constrast<=254);
autoExposure_ = false;
gain_ = gain;
brightness_ = brightness;
contrast_ = constrast;
#endif
}
void CameraMyntEye::setIrControl(int value)
{
#ifdef RTABMAP_MYNTEYE
UASSERT(value>=0 && value<=160);
irControl_ = value;
#endif #endif
} }
@@ -451,6 +469,7 @@ bool CameraMyntEye::init(const std::string & calibrationFolder, const std::strin
api_->SetOptionValue(mynteye::Option::BRIGHTNESS, brightness_); api_->SetOptionValue(mynteye::Option::BRIGHTNESS, brightness_);
api_->SetOptionValue(mynteye::Option::CONTRAST, contrast_); api_->SetOptionValue(mynteye::Option::CONTRAST, contrast_);
} }
api_->SetOptionValue(mynteye::Option::IR_CONTROL, irControl_);
api_->Start(mynteye::Source::ALL); api_->Start(mynteye::Source::ALL);
uSleep(500); // To buffer some imus before sending images uSleep(500); // To buffer some imus before sending images

View File

@@ -738,6 +738,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
connect(_ui->spinBox_stereoMyntEye_gain, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->spinBox_stereoMyntEye_gain, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_stereoMyntEye_brightness, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->spinBox_stereoMyntEye_brightness, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_stereoMyntEye_contrast, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->spinBox_stereoMyntEye_contrast, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_stereoMyntEye_irControl, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->checkbox_rgbd_colorOnly, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->checkbox_rgbd_colorOnly, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
connect(_ui->spinBox_source_imageDecimation, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->spinBox_source_imageDecimation, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
@@ -1919,6 +1920,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
_ui->spinBox_stereoMyntEye_gain->setValue(24); _ui->spinBox_stereoMyntEye_gain->setValue(24);
_ui->spinBox_stereoMyntEye_brightness->setValue(120); _ui->spinBox_stereoMyntEye_brightness->setValue(120);
_ui->spinBox_stereoMyntEye_contrast->setValue(116); _ui->spinBox_stereoMyntEye_contrast->setValue(116);
_ui->spinBox_stereoMyntEye_irControl->setValue(0);
_ui->checkBox_cameraImages_timestamps->setChecked(false); _ui->checkBox_cameraImages_timestamps->setChecked(false);
_ui->checkBox_cameraImages_syncTimeStamps->setChecked(true); _ui->checkBox_cameraImages_syncTimeStamps->setChecked(true);
@@ -2373,6 +2375,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
_ui->spinBox_stereoMyntEye_gain->setValue(settings.value("gain", _ui->spinBox_stereoMyntEye_gain->value()).toInt()); _ui->spinBox_stereoMyntEye_gain->setValue(settings.value("gain", _ui->spinBox_stereoMyntEye_gain->value()).toInt());
_ui->spinBox_stereoMyntEye_brightness->setValue(settings.value("brightness", _ui->spinBox_stereoMyntEye_brightness->value()).toInt()); _ui->spinBox_stereoMyntEye_brightness->setValue(settings.value("brightness", _ui->spinBox_stereoMyntEye_brightness->value()).toInt());
_ui->spinBox_stereoMyntEye_contrast->setValue(settings.value("contrast", _ui->spinBox_stereoMyntEye_contrast->value()).toInt()); _ui->spinBox_stereoMyntEye_contrast->setValue(settings.value("contrast", _ui->spinBox_stereoMyntEye_contrast->value()).toInt());
_ui->spinBox_stereoMyntEye_irControl->setValue(settings.value("ir_control", _ui->spinBox_stereoMyntEye_irControl->value()).toInt());
settings.endGroup(); // MyntEye settings.endGroup(); // MyntEye
settings.beginGroup("Images"); settings.beginGroup("Images");
@@ -2850,6 +2853,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) const
settings.setValue("gain", _ui->spinBox_stereoMyntEye_gain->value()); settings.setValue("gain", _ui->spinBox_stereoMyntEye_gain->value());
settings.setValue("brightness", _ui->spinBox_stereoMyntEye_brightness->value()); settings.setValue("brightness", _ui->spinBox_stereoMyntEye_brightness->value());
settings.setValue("contrast", _ui->spinBox_stereoMyntEye_contrast->value()); settings.setValue("contrast", _ui->spinBox_stereoMyntEye_contrast->value());
settings.setValue("ir_control", _ui->spinBox_stereoMyntEye_irControl->value());
settings.endGroup(); // MyntEye settings.endGroup(); // MyntEye
settings.beginGroup("Images"); settings.beginGroup("Images");
@@ -5702,11 +5706,19 @@ Camera * PreferencesDialog::createCamera(bool useRawImages, bool useColor)
this->getGeneralInputRate(), this->getGeneralInputRate(),
this->getSourceLocalTransform()); this->getSourceLocalTransform());
((CameraMyntEye*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked()); ((CameraMyntEye*)camera)->publishInterIMU(_ui->checkbox_publishInterIMU->isChecked());
((CameraMyntEye*)camera)->setAutoExposure( if(_ui->checkbox_stereoMyntEye_autoExposure->isChecked())
_ui->checkbox_stereoMyntEye_autoExposure->isChecked(), {
_ui->spinBox_stereoMyntEye_gain->value(), ((CameraMyntEye*)camera)->setAutoExposure();
_ui->spinBox_stereoMyntEye_brightness->value(), }
_ui->spinBox_stereoMyntEye_contrast->value()); else
{
((CameraMyntEye*)camera)->setManualExposure(
_ui->spinBox_stereoMyntEye_gain->value(),
_ui->spinBox_stereoMyntEye_brightness->value(),
_ui->spinBox_stereoMyntEye_contrast->value());
}
((CameraMyntEye*)camera)->setIrControl(
_ui->spinBox_stereoMyntEye_irControl->value());
} }
} }
else if(driver == kSrcRGBDImages) else if(driver == kSrcRGBDImages)

View File

@@ -63,7 +63,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-696</y>
<width>680</width> <width>680</width>
<height>3270</height> <height>3270</height>
</rect> </rect>
@@ -95,7 +95,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>14</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="page_22"> <widget class="QWidget" name="page_22">
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
@@ -5372,7 +5372,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLabel" name="label_595"> <widget class="QLabel" name="label_595">
<property name="text"> <property name="text">
<string>Image gain, valid if manual-exposure.</string> <string>Image gain [0-48], valid if manual-exposure.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@@ -5385,7 +5385,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item row="4" column="1"> <item row="4" column="1">
<widget class="QLabel" name="label_596"> <widget class="QLabel" name="label_596">
<property name="text"> <property name="text">
<string>Image brightness, valid if manual-exposure.</string> <string>Image brightness [0-240], valid if manual-exposure.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@@ -5411,7 +5411,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
<item row="5" column="1"> <item row="5" column="1">
<widget class="QLabel" name="label_597"> <widget class="QLabel" name="label_597">
<property name="text"> <property name="text">
<string>Image contrast, valid if manual-exposure.</string> <string>Image contrast [0-254], valid if manual-exposure.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@@ -5431,6 +5431,29 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1">
<widget class="QLabel" name="label_599">
<property name="text">
<string>IR control [0-160]. 0 means that the IR pattern is not projected.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QSpinBox" name="spinBox_stereoMyntEye_irControl">
<property name="maximum">
<number>160</number>
</property>
<property name="value">
<number>116</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>