From 450aef86f7f941da772afe00c4ba0b6131178af6 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Tue, 7 Jun 2011 15:01:39 +0000 Subject: [PATCH] Added rawImageSizeCaptured parameter for Usb source device git-svn-id: http://rtabmap.googlecode.com/svn/branches/0.3/rtabmap@63 f169173b-cf89-36c8-b27e-44dbe73f0c83 --- corelib/WebcamCapture/main.cpp | 20 +++++++------ corelib/include/rtabmap/core/Camera.h | 1 + corelib/src/Camera.cpp | 3 +- .../include/rtabmap/gui/PreferencesDialog.h | 1 + guilib/src/MainWindow.cpp | 1 + guilib/src/PreferencesDialog.cpp | 7 +++++ guilib/src/ui/preferencesDialog.ui | 29 ++++++++++++++++--- 7 files changed, 48 insertions(+), 14 deletions(-) diff --git a/corelib/WebcamCapture/main.cpp b/corelib/WebcamCapture/main.cpp index 98d54189..848c51fc 100644 --- a/corelib/WebcamCapture/main.cpp +++ b/corelib/WebcamCapture/main.cpp @@ -37,10 +37,11 @@ void showUsage() " -device #: Id of the webcam (default 0)\n" " -width #: Image width (default 640)\n" " -height #: Image height (default 480)\n" + " -rawSize Resize image after capturing the with default size\n" " -fps #.#: Frame rate (Hz) (default 2.0)\n" - " -show bool: Image shown while capturing (default true)\n" + " -hide : Image not shown while capturing (default true)\n" " -dir \"path\": Path of the images saved (default \"./imagesCaptured\")\n" - " -save bool: Save images captured (default true)\n" + " -save : Save images captured (default true)\n" " -startId #: Image id to start with (default 1)\n" " -ext \"ext\": Image extension (default \"jpg\")\n" " -debug: Debug trace\n"); @@ -121,10 +122,11 @@ int main(int argc, char * argv[]) int usbDevice = 0; int imageWidth = 640; int imageHeight = 480; + bool rawSize = false; float imageRate = 2.0; int startId = 1; std::string extension = "jpg"; - bool save = true; + bool save = false; std::string targetDirectory = UDirectory::currentDir(true) + "imagesCaptured"; for(int i=1; igetSourceUsbDeviceId(), + _preferencesDialog->isSourceUsbRawImageSizeCaptured(), _preferencesDialog->getGeneralImageRate(), _preferencesDialog->getGeneralAutoRestart(), _preferencesDialog->getSourceWidth(), diff --git a/guilib/src/PreferencesDialog.cpp b/guilib/src/PreferencesDialog.cpp index 040e178e..412e8358 100644 --- a/guilib/src/PreferencesDialog.cpp +++ b/guilib/src/PreferencesDialog.cpp @@ -85,6 +85,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) : connect(_ui->general_checkBox_autoRestart, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel())); //usbDevice group connect(_ui->source_usbDevice_spinBox_id, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); + connect(_ui->general_checkBox_rawImageSizeCaptured, SIGNAL(currentIndexChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->source_spinBox_imgWidth, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); connect(_ui->source_spinBox_imgheight, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel())); //images group @@ -520,6 +521,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath) //usbDevice group settings.beginGroup("usbDevice"); _ui->source_usbDevice_spinBox_id->setValue(settings.value("id",_ui->source_usbDevice_spinBox_id->value()).toInt()); + _ui->general_checkBox_rawImageSizeCaptured->setChecked(settings.value("rawImageSizeCaptured", _ui->general_checkBox_rawImageSizeCaptured->isChecked()).toBool()); settings.endGroup(); // usbDevice //images group settings.beginGroup("images"); @@ -659,6 +661,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath) //usbDevice group settings.beginGroup("usbDevice"); settings.setValue("id", _ui->source_usbDevice_spinBox_id->value()); + settings.setValue("rawImageSizeCaptured", _ui->general_checkBox_rawImageSizeCaptured->isChecked()); settings.endGroup(); //usbDevice //images group settings.beginGroup("images"); @@ -1529,6 +1532,10 @@ int PreferencesDialog::getSourceUsbDeviceId() const { return _ui->source_usbDevice_spinBox_id->value(); } +bool PreferencesDialog::isSourceUsbRawImageSizeCaptured() const +{ + return _ui->general_checkBox_rawImageSizeCaptured->isChecked(); +} QString PreferencesDialog::getSourceDatabasePath() const { return _ui->source_database_lineEdit_path->text(); diff --git a/guilib/src/ui/preferencesDialog.ui b/guilib/src/ui/preferencesDialog.ui index 96a8cb67..884b1d5e 100644 --- a/guilib/src/ui/preferencesDialog.ui +++ b/guilib/src/ui/preferencesDialog.ui @@ -46,6 +46,9 @@ false + + false + @@ -65,7 +68,7 @@ QFrame::Raised - 0 + 1 @@ -546,7 +549,7 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki - 1 + 0 @@ -576,6 +579,24 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki + + + + + + + + + + + Raw image size captured. +If false, the usb driver is configured with the image width/height above. If true, the image is resized after the capture. + + + true + + + @@ -1050,8 +1071,8 @@ We can edit how will like the prediction used in the Bayes filter when there is 0 0 - 518 - 147 + 26 + 78