mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Refactoring CameraRGBD class (now including OpenNI, OpenNI2, OpenNI from OpenCV and Freenect)
Added tool to test RGB-D camera: rtabmap-rgbd_camera Fixed Freenect corrupted depth image (after some time) git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1366 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -50,7 +50,6 @@ void showUsage()
|
||||
" The height must be also specified if changed.\n"
|
||||
" -image_height # Force an image height (Default 0: original size used)\n"
|
||||
" The height must be also specified if changed.\n"
|
||||
" -frames_dropped # Frames dropped from source (Default 0: no frames dropped)\n"
|
||||
" -start_at # When \"path\" is a directory of images, set this parameter\n"
|
||||
" to start processing at image # (default 1)."
|
||||
" -\"parameter name\" \"value\" Overwrite a specific RTAB-Map's parameter :\n"
|
||||
@@ -114,7 +113,6 @@ int main(int argc, char * argv[])
|
||||
int imageWidth = 0;
|
||||
int imageHeight = 0;
|
||||
int startAt = 1;
|
||||
int framesDropped = 0;
|
||||
ParametersMap pm;
|
||||
ULogger::Level logLevel = ULogger::kError;
|
||||
ULogger::Level exitLevel = ULogger::kFatal;
|
||||
@@ -239,23 +237,6 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-frames_dropped") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
framesDropped = std::atoi(argv[i]);
|
||||
if(framesDropped < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-start_at") == 0)
|
||||
{
|
||||
++i;
|
||||
@@ -357,11 +338,11 @@ int main(int argc, char * argv[])
|
||||
Camera * camera = 0;
|
||||
if(UDirectory::exists(path))
|
||||
{
|
||||
camera = new CameraImages(path, startAt, false, 1/rate, imageWidth, imageHeight, framesDropped);
|
||||
camera = new CameraImages(path, startAt, false, 1/rate, imageWidth, imageHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera = new CameraVideo(path, 1/rate, imageWidth, imageHeight, framesDropped);
|
||||
camera = new CameraVideo(path, 1/rate, imageWidth, imageHeight);
|
||||
}
|
||||
|
||||
if(!camera || !camera->init())
|
||||
@@ -402,7 +383,6 @@ int main(int argc, char * argv[])
|
||||
printf(" Repeating data set = %s\n", repeat?"true":"false");
|
||||
printf(" Camera width=%d, height=%d (0 is default)\n", imageWidth, imageHeight);
|
||||
printf(" Camera starts at image %d (default 1)\n", startAt);
|
||||
printf(" Camera frames dropped %d (default 0)\n", framesDropped);
|
||||
if(createGT)
|
||||
{
|
||||
printf(" Creating the ground truth matrix.\n");
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/utilite/UFile.h>
|
||||
#include <rtabmap/core/CameraOpenni.h>
|
||||
#include <rtabmap/core/CameraThread.h>
|
||||
#include <rtabmap/core/CameraRGBD.h>
|
||||
#include <rtabmap/core/Camera.h>
|
||||
#include <rtabmap/core/CameraThread.h>
|
||||
#include <rtabmap/gui/DataRecorder.h>
|
||||
@@ -22,17 +23,12 @@ void showUsage()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rtabmap::CameraOpenni * openniCamera = 0;
|
||||
rtabmap::CameraThread * cam = 0;
|
||||
QApplication * app = 0;
|
||||
// catch ctrl-c
|
||||
void sighandler(int sig)
|
||||
{
|
||||
printf("\nSignal %d caught...\n", sig);
|
||||
if(openniCamera)
|
||||
{
|
||||
openniCamera->kill();
|
||||
}
|
||||
if(cam)
|
||||
{
|
||||
cam->join(true);
|
||||
@@ -119,7 +115,7 @@ int main (int argc, char * argv[])
|
||||
|
||||
if(openni)
|
||||
{
|
||||
openniCamera = new rtabmap::CameraOpenni("", rate, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0));
|
||||
cam = new rtabmap::CameraThread(new rtabmap::CameraOpenni("", rate, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,9 +136,9 @@ int main (int argc, char * argv[])
|
||||
app->processEvents();
|
||||
}
|
||||
|
||||
if(openni?openniCamera->init():cam->init())
|
||||
if(cam->init())
|
||||
{
|
||||
openni?openniCamera->start():cam->start();
|
||||
cam->start();
|
||||
|
||||
app->exec();
|
||||
|
||||
@@ -160,10 +156,6 @@ int main (int argc, char * argv[])
|
||||
UERROR("Cannot initialize the recorder! Maybe the path is wrong: \"%s\"", fileName.toStdString().c_str());
|
||||
}
|
||||
|
||||
if(openniCamera)
|
||||
{
|
||||
delete openniCamera;
|
||||
}
|
||||
if(cam)
|
||||
{
|
||||
delete cam;
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <rtabmap/utilite/UFile.h>
|
||||
#include <rtabmap/core/Odometry.h>
|
||||
#include <rtabmap/gui/OdometryViewer.h>
|
||||
#include <rtabmap/core/CameraOpenni.h>
|
||||
#include <rtabmap/core/CameraThread.h>
|
||||
#include <rtabmap/core/CameraRGBD.h>
|
||||
#include <rtabmap/core/DBReader.h>
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
@@ -555,7 +556,7 @@ int main (int argc, char * argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
rtabmap::CameraOpenni camera("", rate, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0));
|
||||
rtabmap::CameraThread camera(new rtabmap::CameraOpenni("", rate, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0)));
|
||||
if(camera.init())
|
||||
{
|
||||
odomThread.start();
|
||||
|
||||
Reference in New Issue
Block a user