Class Frame
Defined in File frame.hpp
Class Documentation
-
class Frame
Class for the camera frame.
Public Types
Shared pointer alias for Frame.
Public Functions
-
Frame(const data_type::SensorData::weak_ptr cameraData_)
Construct a frame and initialize image features from sensor input.
- Parameters:
cameraData_ – Weak pointer to sensor data for this frame.
-
inline ~Frame()
Destroy the frame object.
-
inline bool is_monocular() const
Checks if the camera data is from a monocular camera.
- Returns:
trueif sensor type is monocular, otherwisefalse.
-
inline data_type::SensorData::SensorType get_sensor_type() const
Get the sensor modality associated with this frame.
- Returns:
Sensor type value from the underlying sensor data.
-
inline frame_id_t get_id() const
Get frame identifier.
- Returns:
Frame ID.
-
inline void set_pose(const pose_t &pose_)
Set frame pose in world coordinates.
- Parameters:
pose_ – New frame pose.
-
inline data_type::SensorData::weak_ptr get_camera_data() const
Get weak pointer to camera data associated with this frame.
- Returns:
Weak pointer to sensor data.
-
inline void set_number_tracked_points(const int numberTrackedPoints_)
Set number of tracked points matched for this frame.
- Parameters:
numberTrackedPoints_ – Number of matched points.
-
inline int get_number_tracked_points() const
Get number of tracked points matched for this frame.
- Returns:
Number of matched points.
-
inline void update_point_id(size_t index_, point_id_t pointId_)
Used to indicate that a point seen by the frame is in the map already and as map point id equal to pointId (input value).
- Parameters:
index_ – Index of the point in frame feature arrays.
pointId_ – Map-point ID corresponding to the indexed frame point.
-
inline void update_mappoint_id(size_t index_, point_id_t pointId_)
Used to indicate that a point seen by the frame is in the map already and as map point id equal to pointId (input value).
- Parameters:
index_ – Index of the point in frame feature arrays.
pointId_ – Map-point ID corresponding to the indexed frame point.
-
void setup_upgrade_to_keyframe()
Compute the 3D points for each 2D keyfeature.
Note
Assumes RGB-D observations are available to recover depth-backed 3D points for keyframe-upgrade data.
-
inline const point3d_t::vector &get_3d_points_camera_frame() const
Get 3D points expressed in the camera coordinate frame.
- Returns:
Const reference to 3D points in camera frame.
-
inline const point_id_t::vector &get_mappoint_ids() const
Get IDs of map points associated with this frame.
- Returns:
Const reference to map-point IDs.
-
inline const point2d_t::vector &get_image_points() const
Get 2D image points used in localization for this frame.
- Returns:
Const reference to selected image keypoints.
-
inline const descriptor_t::vector &get_image_descriptors() const
Get descriptors associated with selected frame keypoints.
- Returns:
Const reference to descriptor vector.
-
inline const point2d_t::vector &get_all_detected_image_points() const
Get all detected image keypoints before localization filtering.
- Returns:
Const reference to all detected image points.
-
inline const descriptor_t::vector &get_all_detected_image_descriptors() const
Get descriptors for all detected image keypoints.
- Returns:
Const reference to all detected image descriptors.
-
void get_neighbors(const keyframe_id_t &keyframeId_, std::unordered_map<point_id_t, neighbor_t::vector> &neighbors_) const
Get the neighbors of a point.
Note
This function fills the neighbors variable that is passed by reference, to avoid copying long maps from the caller.
- Parameters:
keyframeId_ – Keyframe ID associated with this frame.
neighbors_ – Output map of neighbors for each point.
-
inline bool check_frame_success()
Check whether frame construction succeeded.
- Returns:
trueif frame has valid feature content, otherwisefalse.
-
void apply_scale_to_points3d(const double scale_)
Apply a uniform scale factor to frame 3D points.
- Parameters:
scale_ – Scale factor to apply.
-
inline void set_reference_keyframe_id(const keyframe_id_t keyframeId_)
Sets the ID of the reference keyframe of this frame. Reference keyframe is the keyframe to which this frame has the most points in common.
- Parameters:
keyframeId_ – Reference keyframe ID.
-
inline keyframe_id_t get_reference_keyframe_id() const
Get the ID of the reference keyframe of this frame.
- Returns:
Reference keyframe ID.
-
inline void set_upgraded_to_keyframe_id(const keyframe_id_t keyframeId_)
Sets the ID of the keyframe this frame is upgraded to.
- Parameters:
keyframeId_ – Keyframe ID created from this frame.
-
inline keyframe_id_t get_upgraded_to_keyframe_id() const
Gets the ID of the keyframe this frame is upgraded to.
- Returns:
Keyframe ID this frame was upgraded to.
-
inline bool is_keyframe() const
Checks if the frame was upgraded to a keyframe.
- Returns:
True if the frame was upgraded to a keyframe, False otherwise.
-
inline bool valid_keyframe_upgrade() const
Check if the frame has the necessary data to be a keyframe.
- Returns:
True if the frame has the necessary data to be a keyframe, False otherwise.
Public Static Functions
Private Functions
-
inline bool __check_frame_success()
Check whether detected features meet minimum frame requirements.
- Returns:
trueif frame has enough detected points, otherwisefalse.
Private Members
-
frame_id_t _id
Frame Id.
-
data_type::SensorData::shared_ptr _cameraData
camera data (can be stereo, monocular, or RGB-D from different datasets)
-
int _numberTrackedPoints = 0
To save the number of keypoints successfully matches with a previous frame/keyframe/buffer (useful for keyframe-creation decisions)
-
double _minDepth = 0.1
Minimum depth for the 3D points.
-
double _maxDepth = 10.0
Maximum depth for the 3D points.
-
bool _createdWithSuccess = true
Flag that indicate if the frame was successfully created.
-
keyframe_id_t _referenceKeyframe = keyframe_id_t::UNSET
Id of the reference keyframe.
-
keyframe_id_t _upgradedToKeyframeId = keyframe_id_t::UNSET
Note that not all frames are upgraded.
-
point2d_t::vector _allDetectedImagePoints
Keep all the detected image points for better accuracy latter.
-
descriptor_t::vector _allDetectedImageDescriptors
Image Descriptors.
-
point_id_t::vector _allDetectedImagePointIds
Ids of Mappoints for the image points that are matched to the map.
-
descriptor_t::vector _pointsImageDescriptors
Descriptors of the 2D/3D points.
-
point_id_t::vector _pointsInMapIds
Ids of all the detected mappoints in the image.