mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-11 03:59:53 +08:00
GUI:fixed reversed source images/usb. CameraImages: added auto conversion of 4 channels images
This commit is contained in:
@@ -296,6 +296,14 @@ cv::Mat CameraImages::captureImage()
|
|||||||
img = cv::Mat(i, true);
|
img = cv::Mat(i, true);
|
||||||
cvReleaseImage(&i);
|
cvReleaseImage(&i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(img.channels()>3)
|
||||||
|
{
|
||||||
|
UWARN("Conversion from 4 channels to 3 channels (file=%s)", fullPath.c_str());
|
||||||
|
cv::Mat out;
|
||||||
|
cv::cvtColor(img, out, CV_BGRA2BGR);
|
||||||
|
img = out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2484,7 +2484,10 @@ void MainWindow::startDetection()
|
|||||||
{
|
{
|
||||||
ParametersMap parameters = _preferencesDialog->getAllParameters();
|
ParametersMap parameters = _preferencesDialog->getAllParameters();
|
||||||
// verify source with input rates
|
// verify source with input rates
|
||||||
if((_preferencesDialog->isSourceImageUsed() && (_preferencesDialog->getSourceImageType()>0)) ||
|
if((_preferencesDialog->isSourceImageUsed() &&
|
||||||
|
(_preferencesDialog->getSourceImageType() == PreferencesDialog::kSrcImages ||
|
||||||
|
_preferencesDialog->getSourceImageType() == PreferencesDialog::kSrcVideo))
|
||||||
|
||
|
||||||
_preferencesDialog->isSourceDatabaseUsed())
|
_preferencesDialog->isSourceDatabaseUsed())
|
||||||
{
|
{
|
||||||
float inputRate = _preferencesDialog->getGeneralInputRate();
|
float inputRate = _preferencesDialog->getGeneralInputRate();
|
||||||
@@ -2738,7 +2741,8 @@ void MainWindow::startDetection()
|
|||||||
// Change type of the camera...
|
// Change type of the camera...
|
||||||
//
|
//
|
||||||
int sourceType = _preferencesDialog->getSourceImageType();
|
int sourceType = _preferencesDialog->getSourceImageType();
|
||||||
if(sourceType == 1) //Images
|
UASSERT(sourceType >= PreferencesDialog::kSrcUsbDevice && sourceType <= PreferencesDialog::kSrcVideo);
|
||||||
|
if(sourceType == PreferencesDialog::kSrcImages) //Images
|
||||||
{
|
{
|
||||||
camera = new CameraImages(
|
camera = new CameraImages(
|
||||||
_preferencesDialog->getSourceImagesPath().append(QDir::separator()).toStdString(),
|
_preferencesDialog->getSourceImagesPath().append(QDir::separator()).toStdString(),
|
||||||
@@ -2748,7 +2752,7 @@ void MainWindow::startDetection()
|
|||||||
_preferencesDialog->getSourceWidth(),
|
_preferencesDialog->getSourceWidth(),
|
||||||
_preferencesDialog->getSourceHeight());
|
_preferencesDialog->getSourceHeight());
|
||||||
}
|
}
|
||||||
else if(sourceType == 2)
|
else if(sourceType == PreferencesDialog::kSrcVideo)
|
||||||
{
|
{
|
||||||
camera = new CameraVideo(
|
camera = new CameraVideo(
|
||||||
_preferencesDialog->getSourceVideoPath().toStdString(),
|
_preferencesDialog->getSourceVideoPath().toStdString(),
|
||||||
@@ -2756,7 +2760,7 @@ void MainWindow::startDetection()
|
|||||||
_preferencesDialog->getSourceWidth(),
|
_preferencesDialog->getSourceWidth(),
|
||||||
_preferencesDialog->getSourceHeight());
|
_preferencesDialog->getSourceHeight());
|
||||||
}
|
}
|
||||||
else //if(sourceType == 0)
|
else //if(sourceType == PreferencesDialog::kSrcUsbDevice)
|
||||||
{
|
{
|
||||||
camera = new CameraVideo(
|
camera = new CameraVideo(
|
||||||
_preferencesDialog->getSourceUsbDeviceId(),
|
_preferencesDialog->getSourceUsbDeviceId(),
|
||||||
|
|||||||
Reference in New Issue
Block a user