mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 08:47:45 +08:00
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
This commit is contained in:
@@ -37,10 +37,11 @@ void showUsage()
|
|||||||
" -device #: Id of the webcam (default 0)\n"
|
" -device #: Id of the webcam (default 0)\n"
|
||||||
" -width #: Image width (default 640)\n"
|
" -width #: Image width (default 640)\n"
|
||||||
" -height #: Image height (default 480)\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"
|
" -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"
|
" -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"
|
" -startId #: Image id to start with (default 1)\n"
|
||||||
" -ext \"ext\": Image extension (default \"jpg\")\n"
|
" -ext \"ext\": Image extension (default \"jpg\")\n"
|
||||||
" -debug: Debug trace\n");
|
" -debug: Debug trace\n");
|
||||||
@@ -121,10 +122,11 @@ int main(int argc, char * argv[])
|
|||||||
int usbDevice = 0;
|
int usbDevice = 0;
|
||||||
int imageWidth = 640;
|
int imageWidth = 640;
|
||||||
int imageHeight = 480;
|
int imageHeight = 480;
|
||||||
|
bool rawSize = false;
|
||||||
float imageRate = 2.0;
|
float imageRate = 2.0;
|
||||||
int startId = 1;
|
int startId = 1;
|
||||||
std::string extension = "jpg";
|
std::string extension = "jpg";
|
||||||
bool save = true;
|
bool save = false;
|
||||||
std::string targetDirectory = UDirectory::currentDir(true) + "imagesCaptured";
|
std::string targetDirectory = UDirectory::currentDir(true) + "imagesCaptured";
|
||||||
|
|
||||||
for(int i=1; i<argc; ++i)
|
for(int i=1; i<argc; ++i)
|
||||||
@@ -176,10 +178,9 @@ int main(int argc, char * argv[])
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[i], "-show") == 0 && i+1<argc)
|
if(strcmp(argv[i], "-hide") == 0 && i+1<argc)
|
||||||
{
|
{
|
||||||
show = uStr2Bool(argv[i+1]);
|
show = false;
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[i], "-dir") == 0 && i+1<argc)
|
if(strcmp(argv[i], "-dir") == 0 && i+1<argc)
|
||||||
@@ -190,8 +191,7 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
if(strcmp(argv[i], "-save") == 0 && i+1<argc)
|
if(strcmp(argv[i], "-save") == 0 && i+1<argc)
|
||||||
{
|
{
|
||||||
save = uStr2Bool(argv[i+1]);
|
save = true;
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[i], "-debug") == 0)
|
if(strcmp(argv[i], "-debug") == 0)
|
||||||
@@ -217,6 +217,7 @@ int main(int argc, char * argv[])
|
|||||||
" device=%d\n"
|
" device=%d\n"
|
||||||
" width=%d\n"
|
" width=%d\n"
|
||||||
" height=%d\n"
|
" height=%d\n"
|
||||||
|
" rawSize=%d\n"
|
||||||
" hz=%f\n"
|
" hz=%f\n"
|
||||||
" show=%s\n"
|
" show=%s\n"
|
||||||
" dir=%s\n"
|
" dir=%s\n"
|
||||||
@@ -226,6 +227,7 @@ int main(int argc, char * argv[])
|
|||||||
usbDevice,
|
usbDevice,
|
||||||
imageWidth,
|
imageWidth,
|
||||||
imageHeight,
|
imageHeight,
|
||||||
|
uBool2str(rawSize).c_str(),
|
||||||
imageRate,
|
imageRate,
|
||||||
uBool2str(show).c_str(),
|
uBool2str(show).c_str(),
|
||||||
targetDirectory.c_str(),
|
targetDirectory.c_str(),
|
||||||
@@ -235,7 +237,7 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
UDirectory::makeDir(targetDirectory);
|
UDirectory::makeDir(targetDirectory);
|
||||||
|
|
||||||
rtabmap::CameraVideo cam(usbDevice, imageWidth, imageHeight, false, imageRate);
|
rtabmap::CameraVideo cam(usbDevice, rawSize, imageRate, false, imageWidth, imageHeight);
|
||||||
if(!cam.init())
|
if(!cam.init())
|
||||||
{
|
{
|
||||||
printf("Can't initialize the camera...\n");
|
printf("Can't initialize the camera...\n");
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CameraVideo(int usbDevice = 0,
|
CameraVideo(int usbDevice = 0,
|
||||||
|
bool rawImageSizeCaptured = false,
|
||||||
float imageRate = 0,
|
float imageRate = 0,
|
||||||
bool autoRestart = false,
|
bool autoRestart = false,
|
||||||
unsigned int imageWidth = 0,
|
unsigned int imageWidth = 0,
|
||||||
|
|||||||
@@ -438,10 +438,11 @@ IplImage * CameraImages::takeImage()
|
|||||||
// CameraVideo
|
// CameraVideo
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
CameraVideo::CameraVideo(int usbDevice,
|
CameraVideo::CameraVideo(int usbDevice,
|
||||||
|
bool rawImageSizeCaptured,
|
||||||
float imageRate,
|
float imageRate,
|
||||||
bool autoRestart,
|
bool autoRestart,
|
||||||
unsigned int imageWidth,
|
unsigned int imageWidth,
|
||||||
unsigned int imageHeight) :
|
unsigned int imageHeight) :
|
||||||
Camera(imageRate, autoRestart, imageWidth, imageHeight),
|
Camera(imageRate, autoRestart, imageWidth, imageHeight),
|
||||||
_capture(0),
|
_capture(0),
|
||||||
_src(kUsbDevice),
|
_src(kUsbDevice),
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
bool getSourceImagesRefreshDir() const; //Images group
|
bool getSourceImagesRefreshDir() const; //Images group
|
||||||
QString getSourceVideoPath() const; //Video group
|
QString getSourceVideoPath() const; //Video group
|
||||||
int getSourceUsbDeviceId() const; //UsbDevice group
|
int getSourceUsbDeviceId() const; //UsbDevice group
|
||||||
|
bool isSourceUsbRawImageSizeCaptured() const; //UsbDevice group
|
||||||
QString getSourceDatabasePath() const; //Database group
|
QString getSourceDatabasePath() const; //Database group
|
||||||
bool getSourceDatabaseIgnoreChildren() const; //Database group
|
bool getSourceDatabaseIgnoreChildren() const; //Database group
|
||||||
|
|
||||||
|
|||||||
@@ -992,6 +992,7 @@ void MainWindow::startDetection()
|
|||||||
{
|
{
|
||||||
_camera = new CameraVideo(
|
_camera = new CameraVideo(
|
||||||
_preferencesDialog->getSourceUsbDeviceId(),
|
_preferencesDialog->getSourceUsbDeviceId(),
|
||||||
|
_preferencesDialog->isSourceUsbRawImageSizeCaptured(),
|
||||||
_preferencesDialog->getGeneralImageRate(),
|
_preferencesDialog->getGeneralImageRate(),
|
||||||
_preferencesDialog->getGeneralAutoRestart(),
|
_preferencesDialog->getGeneralAutoRestart(),
|
||||||
_preferencesDialog->getSourceWidth(),
|
_preferencesDialog->getSourceWidth(),
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ PreferencesDialog::PreferencesDialog(QWidget * parent) :
|
|||||||
connect(_ui->general_checkBox_autoRestart, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
connect(_ui->general_checkBox_autoRestart, SIGNAL(stateChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||||
//usbDevice group
|
//usbDevice group
|
||||||
connect(_ui->source_usbDevice_spinBox_id, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
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_imgWidth, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||||
connect(_ui->source_spinBox_imgheight, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
connect(_ui->source_spinBox_imgheight, SIGNAL(valueChanged(int)), this, SLOT(makeObsoleteSourcePanel()));
|
||||||
//images group
|
//images group
|
||||||
@@ -520,6 +521,7 @@ void PreferencesDialog::readCameraSettings(const QString & filePath)
|
|||||||
//usbDevice group
|
//usbDevice group
|
||||||
settings.beginGroup("usbDevice");
|
settings.beginGroup("usbDevice");
|
||||||
_ui->source_usbDevice_spinBox_id->setValue(settings.value("id",_ui->source_usbDevice_spinBox_id->value()).toInt());
|
_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
|
settings.endGroup(); // usbDevice
|
||||||
//images group
|
//images group
|
||||||
settings.beginGroup("images");
|
settings.beginGroup("images");
|
||||||
@@ -659,6 +661,7 @@ void PreferencesDialog::writeCameraSettings(const QString & filePath)
|
|||||||
//usbDevice group
|
//usbDevice group
|
||||||
settings.beginGroup("usbDevice");
|
settings.beginGroup("usbDevice");
|
||||||
settings.setValue("id", _ui->source_usbDevice_spinBox_id->value());
|
settings.setValue("id", _ui->source_usbDevice_spinBox_id->value());
|
||||||
|
settings.setValue("rawImageSizeCaptured", _ui->general_checkBox_rawImageSizeCaptured->isChecked());
|
||||||
settings.endGroup(); //usbDevice
|
settings.endGroup(); //usbDevice
|
||||||
//images group
|
//images group
|
||||||
settings.beginGroup("images");
|
settings.beginGroup("images");
|
||||||
@@ -1529,6 +1532,10 @@ int PreferencesDialog::getSourceUsbDeviceId() const
|
|||||||
{
|
{
|
||||||
return _ui->source_usbDevice_spinBox_id->value();
|
return _ui->source_usbDevice_spinBox_id->value();
|
||||||
}
|
}
|
||||||
|
bool PreferencesDialog::isSourceUsbRawImageSizeCaptured() const
|
||||||
|
{
|
||||||
|
return _ui->general_checkBox_rawImageSizeCaptured->isChecked();
|
||||||
|
}
|
||||||
QString PreferencesDialog::getSourceDatabasePath() const
|
QString PreferencesDialog::getSourceDatabasePath() const
|
||||||
{
|
{
|
||||||
return _ui->source_database_lineEdit_path->text();
|
return _ui->source_database_lineEdit_path->text();
|
||||||
|
|||||||
@@ -46,6 +46,9 @@
|
|||||||
<attribute name="headerVisible">
|
<attribute name="headerVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -65,7 +68,7 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_22">
|
<widget class="QWidget" name="page_22">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||||
@@ -546,7 +549,7 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget_2">
|
<widget class="QStackedWidget" name="stackedWidget_2">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_7">
|
<widget class="QWidget" name="page_7">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_30">
|
<layout class="QVBoxLayout" name="verticalLayout_30">
|
||||||
@@ -576,6 +579,24 @@ when using the file type, logs are saved in Logrtabmap.txt (located in the worki
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="general_checkBox_rawImageSizeCaptured">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>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.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -1050,8 +1071,8 @@ We can edit how will like the prediction used in the Bayes filter when there is
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>518</width>
|
<width>26</width>
|
||||||
<height>147</height>
|
<height>78</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
|||||||
Reference in New Issue
Block a user