mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-03 16:27:46 +08:00
Refactored Camera classes and Preferences->Source menu
This commit is contained in:
@@ -26,7 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "rtabmap/core/Rtabmap.h"
|
||||
#include "rtabmap/core/Camera.h"
|
||||
#include "rtabmap/core/CameraRGB.h"
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include "rtabmap/utilite/UFile.h"
|
||||
#include <stdio.h>
|
||||
@@ -118,12 +118,12 @@ int main(int argc, char * argv[])
|
||||
|
||||
int countLoopDetected=0;
|
||||
int i=0;
|
||||
cv::Mat img = camera.takeImage();
|
||||
rtabmap::SensorData data = camera.takeImage();
|
||||
int nextIndex = rtabmap.getLastLocationId()+1;
|
||||
while(!img.empty())
|
||||
while(!data.imageRaw().empty())
|
||||
{
|
||||
// Process image : Main loop of RTAB-Map
|
||||
rtabmap.process(img, nextIndex);
|
||||
rtabmap.process(data.imageRaw(), nextIndex);
|
||||
|
||||
// Check if a loop closure is detected and print some info
|
||||
if(rtabmap.getLoopClosureId())
|
||||
@@ -157,7 +157,7 @@ int main(int argc, char * argv[])
|
||||
++nextIndex;
|
||||
|
||||
//Get next image
|
||||
img = camera.takeImage();
|
||||
data = camera.takeImage();
|
||||
}
|
||||
|
||||
printf("Processing images completed. Loop closures found = %d\n", countLoopDetected);
|
||||
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Create the OpenNI camera, it will send a CameraEvent at the rate specified.
|
||||
// Set transform to camera so z is up, y is left and x going forward
|
||||
CameraRGBD * camera = 0;
|
||||
Camera * camera = 0;
|
||||
Transform opticalRotation(0,0,1,0, -1,0,0,0, 0,-1,0,0);
|
||||
if(driver == 1)
|
||||
{
|
||||
@@ -114,13 +114,14 @@ int main(int argc, char * argv[])
|
||||
camera = new rtabmap::CameraOpenni("", 0, opticalRotation);
|
||||
}
|
||||
|
||||
CameraThread cameraThread(camera);
|
||||
if(!cameraThread.init())
|
||||
if(!camera->init())
|
||||
{
|
||||
UERROR("Camera init failed!");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
CameraThread cameraThread(camera);
|
||||
|
||||
|
||||
// GUI stuff, there the handler will receive RtabmapEvent and construct the map
|
||||
// We give it the camera so the GUI can pause/resume the camera
|
||||
QApplication app(argc, argv);
|
||||
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Create the OpenNI camera, it will send a CameraEvent at the rate specified.
|
||||
// Set transform to camera so z is up, y is left and x going forward
|
||||
CameraRGBD * camera = 0;
|
||||
Camera * camera = 0;
|
||||
Transform opticalRotation(0,0,1,0, -1,0,0,0, 0,-1,0,0);
|
||||
if(driver == 1)
|
||||
{
|
||||
@@ -152,17 +152,17 @@ int main(int argc, char * argv[])
|
||||
camera = new rtabmap::CameraOpenni("", 0, opticalRotation);
|
||||
}
|
||||
|
||||
if(mirroring)
|
||||
{
|
||||
camera->setMirroringEnabled(true);
|
||||
}
|
||||
|
||||
CameraThread cameraThread(camera);
|
||||
if(!cameraThread.init())
|
||||
if(!camera->init())
|
||||
{
|
||||
UERROR("Camera init failed!");
|
||||
//exit(1);
|
||||
}
|
||||
CameraThread cameraThread(camera);
|
||||
if(mirroring)
|
||||
{
|
||||
cameraThread.setMirroringEnabled(true);
|
||||
}
|
||||
|
||||
// GUI stuff, there the handler will receive RtabmapEvent and construct the map
|
||||
// We give it the camera so the GUI can pause/resume the camera
|
||||
|
||||
Reference in New Issue
Block a user