CameraARCore.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, 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 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON 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
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef CAMERAARCORE_H_
29 #define CAMERAARCORE_H_
30 
31 #include "CameraMobile.h"
32 #include <rtabmap/core/Camera.h>
34 #include <rtabmap/utilite/UMutex.h>
38 #include <rtabmap/utilite/UEvent.h>
39 #include <rtabmap/utilite/UTimer.h>
40 #include <boost/thread/mutex.hpp>
41 #include <background_renderer.h>
42 
43 #include <arcore_c_api.h>
44 #include <camera/NdkCameraDevice.h>
45 #include <camera/NdkCameraManager.h>
46 #include <media/NdkImageReader.h>
47 #include <android/native_window.h>
48 
49 namespace rtabmap {
50 
51 class CameraARCore : public CameraMobile {
52 public:
54  const float * pointCloudData,
55  int points,
56  const Transform & pose,
57  const CameraModel & model,
58  const cv::Mat & rgb,
59  std::vector<cv::KeyPoint> * kpts = 0,
60  std::vector<cv::Point3f> * kpts3D = 0);
61 
62 public:
63  CameraARCore(void* env, void* context, void* activity, bool depthFromMotion = false, bool smoothing = false);
64  virtual ~CameraARCore();
65 
66  virtual void setScreenRotationAndSize(ScreenRotation colorCameraToDisplayRotation, int width, int height);
67 
68  virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "");
69  virtual void close(); // close ARCore connection
70  virtual std::string getSerial() const;
71 
72 protected:
73  virtual SensorData updateDataOnRender(Transform & pose); // should be called in opengl thread
74 
75 private:
76  rtabmap::Transform getPoseAtTimestamp(double timestamp);
77 
78 private:
79  void * env_;
80  void * context_;
81  void * activity_;
82  ArSession* arSession_ = nullptr;
83  ArConfig* arConfig_ = nullptr;
84  ArFrame* arFrame_ = nullptr;
85  ArCameraIntrinsics *arCameraIntrinsics_ = nullptr;
86  ArPose * arPose_ = nullptr;
89 
91 };
92 
93 } /* namespace rtabmap */
94 #endif /* CAMERAARCORE_H_ */
rtabmap::SensorData
Definition: SensorData.h:51
rtabmap::CameraARCore::activity_
void * activity_
Definition: CameraARCore.h:81
background_renderer.h
CameraMobile.h
rtabmap::CameraARCore::setScreenRotationAndSize
virtual void setScreenRotationAndSize(ScreenRotation colorCameraToDisplayRotation, int width, int height)
Definition: CameraARCore.cpp:323
rtabmap::CameraARCore::close
virtual void close()
Definition: CameraARCore.cpp:239
rtabmap::CameraModel
Definition: CameraModel.h:38
rtabmap::CameraARCore::arCameraIntrinsics_
ArCameraIntrinsics * arCameraIntrinsics_
Definition: CameraARCore.h:85
rtabmap::CameraARCore::arSession_
ArSession * arSession_
Definition: CameraARCore.h:82
GeodeticCoords.h
rtabmap::CameraARCore::arInstallRequested_
bool arInstallRequested_
Definition: CameraARCore.h:87
rtabmap::CameraARCore::updateDataOnRender
virtual SensorData updateDataOnRender(Transform &pose)
Definition: CameraARCore.cpp:337
rtabmap::LaserScan
Definition: LaserScan.h:37
rtabmap::CameraARCore::arSessionMutex_
UMutex arSessionMutex_
Definition: CameraARCore.h:88
UTimer.h
rtabmap::CameraARCore::context_
void * context_
Definition: CameraARCore.h:80
rtabmap::CameraARCore::getSerial
virtual std::string getSerial() const
Definition: CameraARCore.cpp:119
rtabmap::CameraARCore::arPose_
ArPose * arPose_
Definition: CameraARCore.h:86
UEvent.h
UMutex
Definition: UMutex.h:54
rtabmap::CameraARCore::scanFromPointCloudData
static LaserScan scanFromPointCloudData(const float *pointCloudData, int points, const Transform &pose, const CameraModel &model, const cv::Mat &rgb, std::vector< cv::KeyPoint > *kpts=0, std::vector< cv::Point3f > *kpts3D=0)
Definition: CameraARCore.cpp:275
UMutex.h
rtabmap::CameraARCore
Definition: CameraARCore.h:51
rtabmap::CameraARCore::init
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Definition: CameraARCore.cpp:124
rtabmap::CameraARCore::getPoseAtTimestamp
rtabmap::Transform getPoseAtTimestamp(double timestamp)
UEventsSender.h
rtabmap::Transform
Definition: Transform.h:41
rtabmap::CameraARCore::~CameraARCore
virtual ~CameraARCore()
Definition: CameraARCore.cpp:50
rtabmap::ScreenRotation
ScreenRotation
Definition: util.h:194
env
USemaphore.h
UThread.h
rtabmap::CameraMobile
Definition: CameraMobile.h:71
Camera.h
rtabmap::CameraARCore::CameraARCore
CameraARCore(void *env, void *context, void *activity, bool depthFromMotion=false, bool smoothing=false)
Definition: CameraARCore.cpp:40
rtabmap::CameraARCore::arFrame_
ArFrame * arFrame_
Definition: CameraARCore.h:84
rtabmap::CameraARCore::arConfig_
ArConfig * arConfig_
Definition: CameraARCore.h:83
rtabmap
Definition: CameraARCore.cpp:35
trace.model
model
Definition: trace.py:4
rtabmap::CameraARCore::depthFromMotion_
bool depthFromMotion_
Definition: CameraARCore.h:90
rtabmap::CameraARCore::env_
void * env_
Definition: CameraARCore.h:79


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:07