mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Updated CameraFreenect2 with latest freenect2 library (commit cdeb07917c)
This commit is contained in:
@@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QDialog>
|
||||
#include <rtabmap/core/SensorData.h>
|
||||
|
||||
class QSpinBox;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class ImageView;
|
||||
@@ -55,6 +57,8 @@ private:
|
||||
ImageView* imageView_;
|
||||
CloudViewer* cloudView_;
|
||||
bool processingImages_;
|
||||
QSpinBox * decimationSpin_;
|
||||
int validDecimationValue_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
@@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <rtabmap/core/CameraEvent.h>
|
||||
#include <rtabmap/core/util3d.h>
|
||||
#include <rtabmap/core/util2d.h>
|
||||
#include <rtabmap/gui/ImageView.h>
|
||||
#include <rtabmap/gui/CloudViewer.h>
|
||||
#include <rtabmap/utilite/UCv2Qt.h>
|
||||
@@ -36,6 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
namespace rtabmap {
|
||||
@@ -45,7 +48,8 @@ CameraViewer::CameraViewer(QWidget * parent) :
|
||||
QDialog(parent),
|
||||
imageView_(new ImageView(this)),
|
||||
cloudView_(new CloudViewer(this)),
|
||||
processingImages_(false)
|
||||
processingImages_(false),
|
||||
validDecimationValue_(1)
|
||||
{
|
||||
qRegisterMetaType<rtabmap::SensorData>("rtabmap::SensorData");
|
||||
|
||||
@@ -56,15 +60,27 @@ CameraViewer::CameraViewer(QWidget * parent) :
|
||||
layout->addWidget(imageView_,1);
|
||||
layout->addWidget(cloudView_,1);
|
||||
|
||||
QLabel * decimationLabel = new QLabel("Decimation", this);
|
||||
decimationSpin_ = new QSpinBox(this);
|
||||
decimationSpin_->setMinimum(1);
|
||||
decimationSpin_->setMaximum(16);
|
||||
decimationSpin_->setValue(1);
|
||||
|
||||
QDialogButtonBox * buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
QHBoxLayout * layout2 = new QHBoxLayout();
|
||||
layout2->addWidget(decimationLabel);
|
||||
layout2->addWidget(decimationSpin_);
|
||||
layout2->addStretch(1);
|
||||
layout2->addWidget(buttonBox);
|
||||
|
||||
QVBoxLayout * vlayout = new QVBoxLayout(this);
|
||||
vlayout->setMargin(0);
|
||||
vlayout->setSpacing(0);
|
||||
vlayout->addLayout(layout, 1);
|
||||
vlayout->addWidget(buttonBox);
|
||||
vlayout->addLayout(layout2);
|
||||
|
||||
this->setLayout(vlayout);
|
||||
}
|
||||
@@ -76,26 +92,48 @@ CameraViewer::~CameraViewer()
|
||||
|
||||
void CameraViewer::showImage(const rtabmap::SensorData & data)
|
||||
{
|
||||
if(!data.imageRaw().empty() || !data.depthOrRightRaw().empty())
|
||||
{
|
||||
if(data.imageRaw().cols % decimationSpin_->value() == 0 &&
|
||||
data.imageRaw().rows % decimationSpin_->value() == 0 &&
|
||||
data.depthOrRightRaw().cols % decimationSpin_->value() == 0 &&
|
||||
data.depthOrRightRaw().rows % decimationSpin_->value() == 0)
|
||||
{
|
||||
validDecimationValue_ = decimationSpin_->value();
|
||||
}
|
||||
else
|
||||
{
|
||||
UWARN("Decimation (%d) must be a denominator of the width and height of "
|
||||
"the image (color=%d/%d depth=%d/%d). Using last valid decimation value (%d).",
|
||||
decimationSpin_->value(),
|
||||
data.imageRaw().cols,
|
||||
data.imageRaw().rows,
|
||||
data.depthOrRightRaw().cols,
|
||||
data.depthOrRightRaw().rows,
|
||||
validDecimationValue_);
|
||||
}
|
||||
}
|
||||
|
||||
processingImages_ = true;
|
||||
if(!data.imageRaw().empty())
|
||||
{
|
||||
imageView_->setImage(uCvMat2QImage(data.imageRaw()));
|
||||
imageView_->setImage(uCvMat2QImage(util2d::decimate(data.imageRaw(), validDecimationValue_)));
|
||||
}
|
||||
if(!data.depthOrRightRaw().empty())
|
||||
{
|
||||
imageView_->setImageDepth(uCvMat2QImage(data.depthOrRightRaw()));
|
||||
imageView_->setImageDepth(uCvMat2QImage(util2d::decimate(data.depthOrRightRaw(), validDecimationValue_)));
|
||||
}
|
||||
if((data.stereoCameraModel().isValid() || (data.cameraModels().size() && data.cameraModels().at(0).isValid())))
|
||||
{
|
||||
if(!data.imageRaw().empty() && !data.depthOrRightRaw().empty())
|
||||
{
|
||||
cloudView_->addOrUpdateCloud("cloud", util3d::cloudRGBFromSensorData(data));
|
||||
cloudView_->addOrUpdateCloud("cloud", util3d::cloudRGBFromSensorData(data, validDecimationValue_));
|
||||
cloudView_->setVisible(true);
|
||||
cloudView_->update();
|
||||
}
|
||||
else if(!data.depthOrRightRaw().empty())
|
||||
{
|
||||
cloudView_->addOrUpdateCloud("cloud", util3d::cloudFromSensorData(data));
|
||||
cloudView_->addOrUpdateCloud("cloud", util3d::cloudFromSensorData(data, validDecimationValue_));
|
||||
cloudView_->setVisible(true);
|
||||
cloudView_->update();
|
||||
}
|
||||
|
||||
@@ -3626,7 +3626,7 @@ Camera * PreferencesDialog::createCamera(bool useRawImages)
|
||||
{
|
||||
camera = new CameraFreenect2(
|
||||
this->getSourceDevice().isEmpty()?0:atoi(this->getSourceDevice().toStdString().c_str()),
|
||||
useRawImages?CameraFreenect2::kTypeRGBIR:(CameraFreenect2::Type)_ui->comboBox_freenect2Format->currentIndex(),
|
||||
useRawImages?CameraFreenect2::kTypeColorIR:(CameraFreenect2::Type)_ui->comboBox_freenect2Format->currentIndex(),
|
||||
this->getGeneralInputRate(),
|
||||
this->getSourceLocalTransform());
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>1705</height>
|
||||
<width>759</width>
|
||||
<height>966</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@@ -86,7 +86,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>16</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_22">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@@ -1874,7 +1874,7 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget_rgbd">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_32">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_63">
|
||||
@@ -2145,17 +2145,22 @@ when using the file type, logs are saved in LogRtabmap.txt (located in the worki
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RGB+Depth SD</string>
|
||||
<string>Registered Color to Depth SD</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RGB+Depth HD</string>
|
||||
<string>Registered Depth to Color HD</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>IR+Depth</string>
|
||||
<string>Registered Depth to Color SD</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>IR + Depth</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user