Calibration tool files...

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1588 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-07-22 22:23:52 +00:00
parent c1497d9e92
commit 3615ea1e21
2 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
SET(INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/corelib/include
${PROJECT_SOURCE_DIR}/guilib/include
${PROJECT_SOURCE_DIR}/utilite/include
${OpenCV_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
INCLUDE(${QT_USE_FILE})
SET(LIBRARIES
${OpenCV_LIBRARIES}
${PCL_LIBRARIES}
${QT_LIBRARIES}
)
add_definitions(${PCL_DEFINITIONS})
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
ADD_EXECUTABLE(calibration main.cpp)
TARGET_LINK_LIBRARIES(calibration rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
SET_TARGET_PROPERTIES( calibration
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-calibration)
INSTALL(TARGETS calibration
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT runtime
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime)

119
tools/Calibration/main.cpp Normal file
View File

@@ -0,0 +1,119 @@
/*
* Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke
*
* This file is part of RTAB-Map.
*
* RTAB-Map is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RTAB-Map is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RTAB-Map. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rtabmap/core/CameraRGBD.h"
#include "rtabmap/core/CameraThread.h"
#include "rtabmap/utilite/ULogger.h"
#include "rtabmap/gui/CalibrationDialog.h"
#include <QtGui/QApplication>
void showUsage()
{
printf("\nUsage:\n"
"rtabmap-calibration driver\n"
" driver Driver number to use: 0=OpenNI-PCL, 1=OpenNI2, 2=Freenect, 3=OpenNI-CV, 4=OpenNI-CV-ASUS\n\n");
exit(1);
}
int main(int argc, char * argv[])
{
ULogger::setType(ULogger::kTypeConsole);
ULogger::setLevel(ULogger::kInfo);
int driver = 0;
if(argc < 2)
{
showUsage();
}
else
{
driver = atoi(argv[argc-1]);
if(driver < 0 || driver > 4)
{
UERROR("driver should be between 0 and 4.");
showUsage();
}
}
UINFO("Using driver %d", driver);
float imageRate = 1.0f;
rtabmap::CameraRGBD * camera = 0;
if(driver == 0)
{
camera = new rtabmap::CameraOpenni("", imageRate);
}
else if(driver == 1)
{
if(!rtabmap::CameraOpenNI2::available())
{
UERROR("Not built with OpenNI2 support...");
exit(-1);
}
camera = new rtabmap::CameraOpenNI2(imageRate);
}
else if(driver == 2)
{
if(!rtabmap::CameraFreenect::available())
{
UERROR("Not built with Freenect support...");
exit(-1);
}
camera = new rtabmap::CameraFreenect(0, imageRate);
}
else if(driver == 3)
{
if(!rtabmap::CameraOpenNICV::available())
{
UERROR("Not built with OpenNI from OpenCV support...");
exit(-1);
}
camera = new rtabmap::CameraOpenNICV(false, imageRate);
}
else if(driver == 4)
{
if(!rtabmap::CameraOpenNICV::available())
{
UERROR("Not built with OpenNI from OpenCV support...");
exit(-1);
}
camera = new rtabmap::CameraOpenNICV(true, imageRate);
}
else
{
UFATAL("");
}
if(!camera->init())
{
printf("Camera init failed!\n");
delete camera;
exit(1);
}
rtabmap::CameraThread cameraThread(camera);
QApplication app(argc, argv);
rtabmap::CalibrationDialog dialog;
dialog.registerToEventsManager();
dialog.show();
cameraThread.start();
app.exec();
cameraThread.join(true);
}