Ocean
Loading...
Searching...
No Matches
tracking/slam/Utilities.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TRACKING_SLAM_UTILITIES_H
9#define META_OCEAN_TRACKING_SLAM_UTILITIES_H
10
13
14#include "ocean/base/Frame.h"
15
18
19namespace Ocean
20{
21
22namespace Tracking
23{
24
25namespace SLAM
26{
27
28/**
29 * This class implements utility functions for SLAM.
30 * @ingroup trackingslam
31 */
32class OCEAN_TRACKING_SLAM_EXPORT Utilities
33{
34 public:
35
36 /**
37 * Paints object points and feature tracks into a frame, coloring object points by their localization precision.
38 * @param frame The frame to paint into, must be valid and have FORMAT_RGB24
39 * @param cameraClipper The camera clipper used for projecting 3D points to image coordinates
40 * @param world_T_camera The transformation from camera to world coordinates
41 * @param debugData The debug data containing object points and feature tracks
42 * @param maximalTrackLength The maximum number of track points to draw per track, with range [1, infinity)
43 * @param darkeningFactor Optional factor to darken the frame before painting, 0 to disable, with range [0, infinity)
44 * @return True, if succeeded
45 */
46 static bool paintDebugDataByLocalizationPrecision(Frame& frame, const AnyCameraClipper& cameraClipper, const HomogenousMatrix4& world_T_camera, const TrackerMono::DebugData& debugData, const size_t maximalTrackLength, const unsigned int darkeningFactor = 0u);
47
48 /**
49 * Paints object points and feature tracks into a frame, coloring object points by their pose estimation precision.
50 * @param frame The frame to paint into, must be valid and have FORMAT_RGB24
51 * @param cameraClipper The camera clipper used for projecting 3D points to image coordinates
52 * @param world_T_camera The transformation from camera to world coordinates
53 * @param debugData The debug data containing object points and feature tracks
54 * @param maximalTrackLength The maximum number of track points to draw per track, with range [1, infinity)
55 * @param darkeningFactor Optional factor to darken the frame before painting, 0 to disable, with range [0, infinity)
56 * @return True, if succeeded
57 */
58 static bool paintDebugDataByPosePrecision(Frame& frame, const AnyCameraClipper& cameraClipper, const HomogenousMatrix4& world_T_camera, const TrackerMono::DebugData& debugData, const size_t maximalTrackLength, const unsigned int darkeningFactor = 0u);
59
60 /**
61 * Paints object points into a frame using a uniform green color.
62 * @param frame The frame to paint into, must be valid and have FORMAT_RGB24
63 * @param cameraClipper The camera clipper used for projecting 3D points to image coordinates
64 * @param world_T_camera The transformation from camera to world coordinates
65 * @param debugData The debug data containing object points
66 * @param darkeningFactor Optional factor to darken the frame before painting, 0 to disable, with range [0, infinity)
67 * @return True, if succeeded
68 */
69 static bool paintObjectPoints(Frame& frame, const AnyCameraClipper& cameraClipper, const HomogenousMatrix4& world_T_camera, const TrackerMono::DebugData& debugData, const unsigned int darkeningFactor = 0u);
70
71 /**
72 * Serializes FramesStatistics to a JSON file.
73 * @param framesStatistics The frames statistics to serialize
74 * @param filename The name of the file to write to, must not be empty
75 * @return True, if the serialization succeeded
76 */
77 static bool serializeFramesStatisticsToJSON(const TrackerMono::FramesStatistics& framesStatistics, const std::string& filename);
78
79 /**
80 * Deserializes FramesStatistics from a JSON file.
81 * @param filename The name of the file to read from, must not be empty
82 * @param framesStatistics The resulting frames statistics
83 * @return True, if the deserialization succeeded
84 */
85 static bool deserializeFramesStatisticsFromJSON(const std::string& filename, TrackerMono::FramesStatistics& framesStatistics);
86};
87
88}
89
90}
91
92}
93
94#endif // META_OCEAN_TRACKING_SLAM_UTILITIES_H
This class implements a helper class allowing to check whether a 3D object point projects into the ca...
Definition AnyCamera.h:518
This class implements Ocean's image class.
Definition Frame.h:1879
This class holds debug data for visualization and analysis purposes.
Definition slam/TrackerMono.h:305
std::vector< FrameStatistics > FramesStatistics
Definition of a vector holding frame statistics.
Definition slam/TrackerMono.h:100
This class implements utility functions for SLAM.
Definition tracking/slam/Utilities.h:33
static bool paintObjectPoints(Frame &frame, const AnyCameraClipper &cameraClipper, const HomogenousMatrix4 &world_T_camera, const TrackerMono::DebugData &debugData, const unsigned int darkeningFactor=0u)
Paints object points into a frame using a uniform green color.
static bool deserializeFramesStatisticsFromJSON(const std::string &filename, TrackerMono::FramesStatistics &framesStatistics)
Deserializes FramesStatistics from a JSON file.
static bool serializeFramesStatisticsToJSON(const TrackerMono::FramesStatistics &framesStatistics, const std::string &filename)
Serializes FramesStatistics to a JSON file.
static bool paintDebugDataByPosePrecision(Frame &frame, const AnyCameraClipper &cameraClipper, const HomogenousMatrix4 &world_T_camera, const TrackerMono::DebugData &debugData, const size_t maximalTrackLength, const unsigned int darkeningFactor=0u)
Paints object points and feature tracks into a frame, coloring object points by their pose estimation...
static bool paintDebugDataByLocalizationPrecision(Frame &frame, const AnyCameraClipper &cameraClipper, const HomogenousMatrix4 &world_T_camera, const TrackerMono::DebugData &debugData, const size_t maximalTrackLength, const unsigned int darkeningFactor=0u)
Paints object points and feature tracks into a frame, coloring object points by their localization pr...
The namespace covering the entire Ocean framework.
Definition Accessor.h:15