RTAB-Map 0.25.2
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
CameraEinstar.h
1/*
2Copyright (c) 2010-2026, 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
29#pragma once
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include "rtabmap/core/CameraModel.h"
34#include "rtabmap/core/Camera.h"
35#include "rtabmap/core/Version.h"
36
37#include <memory>
38#include <string>
39#include <vector>
40
41namespace einstar
42{
43class Device;
44class StereoDepth;
45}
46
47namespace rtabmap
48{
49
64class RTABMAP_CORE_EXPORT CameraEinstar :
65 public Camera
66{
67public:
68 static bool available();
69
70public:
72 const std::string & calibrationPath = "",
73 const std::string & replayDir = "",
74 float imageRate = 0.0f,
75 const Transform & localTransform = Transform::getIdentity());
76 virtual ~CameraEinstar();
77
78 virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
79 virtual bool isCalibrated() const;
80 virtual std::string getSerial() const;
81
82 // Stereo matching parameters (see einstar::DepthParams), defaults are
83 // libeinstar's: working range (mm), scale of the rectified images used
84 // for matching, and horizontal stretches of the right image to match at
85 // (in order, later ones only fill pixels without depth).
86 void setDepthRange(float minDepthMm, float maxDepthMm);
87 void setMatchingScale(double scale);
88 void setStretches(const std::vector<double> & stretches);
89 // Returns false (parameters unchanged) if not built with libeinstar.
90 static bool getDefaultDepthParameters(
91 float & minDepthMm,
92 float & maxDepthMm,
93 double & scale,
94 std::vector<double> & stretches);
95
96 // Scanner lighting (see einstar::ScanSettings), live only: IR speckle
97 // projector and white texture LED luminance (strobe routes 0 and 1), laser
98 // brightness (%) and IR camera gain. EXStar turns the texture LEDs off when
99 // scanning without texture and drives the projector harder (observed:
100 // projector 3000, LEDs 0, laser 60, gain 100).
101 void setLighting(int projectorLuminance, int textureLuminance, int laserPercent, int irGain);
102 // IR exposure (us). With autoExposure, it is the starting value and
103 // einstar::AutoExposure keeps the bright end (99th percentile) of the IR
104 // images near aeTarget (0-255); without, it stays fixed. EXStar lets a few
105 // percent of the speckle saturate, which gave more depth on hardware.
106 void setExposure(bool autoExposure, int irExposureUs, double aeTarget);
107 // Returns false (parameters unchanged) if not built with libeinstar.
108 static bool getDefaultLighting(
109 int & projectorLuminance,
110 int & textureLuminance,
111 int & laserPercent,
112 int & irGain,
113 int & irExposureUs,
114 double & aeTarget);
115
116protected:
117 virtual SensorData captureImage(SensorCaptureInfo * info = 0);
118
119private:
120 struct Impl;
121 std::string calibrationPath_;
122 std::string replayDir_;
123 float minDepthMm_;
124 float maxDepthMm_;
125 double scale_;
126 std::vector<double> stretches_;
127 int projectorLuminance_;
128 int textureLuminance_;
129 int laserPercent_;
130 int irGain_;
131 bool autoExposure_;
132 int irExposureUs_;
133 double aeTarget_;
134#ifdef RTABMAP_EINSTAR
135 std::unique_ptr<Impl> impl_;
136#endif
137};
138
139} // namespace rtabmap
virtual std::string getSerial() const
Returns the sensor's serial number or unique identifier.
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Initializes the sensor.
Metadata structure for sensor data capture and processing.
Container class for all sensor data captured at a specific time.
Definition SensorData.h:97
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53