RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
CameraVideo.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the Universite de Sherbrooke nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#pragma once
29
30#include <opencv2/highgui/highgui.hpp>
31#include "rtabmap/core/Camera.h"
32
33namespace rtabmap
34{
35
36class RTABMAP_CORE_EXPORT CameraVideo :
37 public Camera
38{
39public:
40 enum Source{kVideoFile, kUsbDevice};
41
42public:
43 CameraVideo(int usbDevice = 0,
44 bool rectifyImages = false,
45 float imageRate = 0,
46 const Transform & localTransform = Transform::getIdentity());
47 CameraVideo(const std::string & filePath,
48 bool rectifyImages = false,
49 float imageRate = 0,
50 const Transform & localTransform = Transform::getIdentity());
51 virtual ~CameraVideo();
52
53 virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
54 virtual bool isCalibrated() const;
55 virtual std::string getSerial() const;
56 int getUsbDevice() const {return _usbDevice;}
57 const std::string & getFilePath() const {return _filePath;}
58
64 void setResolution(int width, int height) {_width=width, _height=height;}
65 void setFOURCC(const std::string & fourcc) { _fourcc = fourcc; }
66
67protected:
68 virtual SensorData captureImage(SensorCaptureInfo * info = 0);
69
70private:
71 // File type
72 std::string _filePath;
73 bool _rectifyImages;
74
75 cv::VideoCapture _capture;
76 Source _src;
77
78 // Usb camera
79 int _usbDevice;
80 std::string _guid;
81 int _width;
82 int _height;
83 std::string _fourcc;
84
85 CameraModel _model;
86};
87
88
89} // namespace rtabmap
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Initializes the sensor.
void setResolution(int width, int height)
Definition CameraVideo.h:64
virtual std::string getSerial() const
Returns the sensor's serial number or unique identifier.
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53