EasyMVS
simple 3D reconstruction framework
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Attributes | Friends | List of all members
FrameObject Class Reference
Inheritance diagram for FrameObject:
Inheritance graph
[legend]
Collaboration diagram for FrameObject:
Collaboration graph
[legend]

Classes

class  RelatedFrameInfo
 the related frame info class, related frame can be defined as the frames that have common field of views. which store Interframe information such as pose between two frames, prior believe of the pose, and the matched keypoints between frames. More...
 

Public Types

using Ptr = std::shared_ptr< FrameObject >
 
- Public Types inherited from DataFlowObject
using Ptr = std::shared_ptr< DataFlowObject >
 the shared pointer type of DataFlowObject
 

Public Member Functions

 FrameObject ()
 Construct a new Frame Object object.
 
 FrameObject (int ID, uint32_t Timestamp=0)
 Construct a new Frame Object object. More...
 
virtual ~FrameObject ()
 Destroy the Frame Object object.
 
int getID ()
 Get the Frame ID. More...
 
uint32_t getTimestamp ()
 Get the timestamp. More...
 
bool setTimestamp (uint32_t time)
 set the timestamp. More...
 
bool setBestFrame (RelatedFrameInfo::Ptr FramePtr)
 set the best frame, the best camera pair is the camera that will be used during dual camera dense reconstruction. the best frame should be set after pose reconstruction in mono camera scenario, or be set when the frame is generated in dual camera or RGBD camera scenario. More...
 
RelatedFrameInfo::Ptr getBestFrame ()
 get the best frame. More...
 
bool addRelatedFrame (RelatedFrameInfo::Ptr FramePtr)
 add relate frame, the related frame is the frame with common field of view, it may because the two frames have matched feature points, or because the two frames are created from an dual cameras, or RGBD camera. More...
 
bool removeRelatedFrame (int FrameID)
 remove the related camera frame, the related camera frame is the frame which has the common filed of view with current frame. More...
 
bool removeAllRelatedFrames ()
 remove all of the related camera frame of current frame. More...
 
bool updateRelatedFrame (RelatedFrameInfo::Ptr FramePtr)
 update related frame. More...
 
RelatedFrameInfo::Ptr getRelatedFrame (int FrameID)
 Get the Related Frame object. More...
 
bool getAllRelatedFrames (std::set< RelatedFrameInfo::Ptr > &Frames)
 Get all the Related Frames object. More...
 
bool getAllRelatedFrames (std::set< int > &FrameID)
 get all the related frame id. More...
 
int hasRelatedFrame ()
 
bool addMapPoint (int KeyPointID, std::shared_ptr< MapPointObject > MapPoint, const Eigen::Vector4d &LocalCoordinate)
 add frame observed map point More...
 
bool removeMapPoint (int KeyPointID)
 remove map point from frame More...
 
bool removeAllMapPoints ()
 remove all map points More...
 
bool getMapPoint (int KeyPointID, std::shared_ptr< MapPointObject > &MapPoint, Eigen::Vector4d &LocalCoordinate)
 Get the Map Point object. More...
 
bool getMapPoint (int KeyPointID, int &MappointID, Eigen::Vector4d &LocalCoordinate)
 get mappoint id related to keypoint. More...
 
std::shared_ptr< MapPointObjectgetMapPoint (int KeyPointID)
 Get the Map Point object.
 
bool hasMappoint (int KeyPointID)
 
bool getAllMappointID (std::set< int > &KeyPointID)
 get all keypoint id related to mappoint. More...
 
bool updateMapPoint (int KeyPointID, std::shared_ptr< MapPointObject > MapPoint, const Eigen::Vector4d &LocalCoordinate)
 update the map point More...
 
virtual bool load (JsonNode &fs) override
 load data and settings from file More...
 
virtual bool save (JsonNode &fs) override
 save data and settings to file More...
 
virtual std::string type_name () override
 get the typename. More...
 
Sophus::SE3d getGlobalPose ()
 
void setGlobalPose (Sophus::SE3d &pose)
 
Sophus::SE3d & GlobalPose ()
 
bool isGlobalPoseKnown ()
 
- Public Member Functions inherited from DataFlowObject
 DataFlowObject ()
 Construct a new Data Flow Object object.
 
virtual ~DataFlowObject ()
 Destroy the Data Flow Object object.
 
- Public Member Functions inherited from MVSObject
 MVSObject ()
 Construct a new MVSObject object.
 
virtual ~MVSObject ()
 Destroy the MVSObject object.
 
virtual bool save (JsonNode &fs)=0
 save data and settings to file More...
 
virtual bool load (JsonNode &fs)=0
 load data and settings from file More...
 
virtual std::string type_name ()
 get the typename. More...
 

Static Public Member Functions

static Ptr Create (int ID, int MapID, const cv::Mat &RGBMat, uint32_t Timestamp=0, const cv::Mat &XYZMat=cv::Mat())
 Create FrameObject object. More...
 
static Ptr Create (int ID, int MapID, uint32_t Timestamp=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Static Public Member Functions inherited from DataFlowObject
static void cvMat2Sophus (const cv::Mat1d &Mat, Sophus::SE3d &Pose)
 create shared pointer of DataFlowObject, do NOT use this method directly, use the Create() method in derived class. More...
 
static void Sophus2cvMat (const Sophus::SE3d &pose, cv::Mat1d &Mat)
 
static cv::Mat1d Rt2T (const cv::Mat1d &R, const cv::Mat1d &t)
 
static std::tuple< cv::Mat1d, cv::Mat1d > T2Rt (const cv::Mat1d &T)
 

Public Attributes

cv::Mat RGBMat
 the RGB image in the current frame the current frame may NOT contain RGB frame, if the frame is created by projectors, the RGB image is empty.
 
cv::Mat XYZMat
 the depth map in the current frame the current frame may contain depth map when it is created, if the frame is created by RGBD cameras, the original depth map will be stored here when frame is created.
 
std::vector< cv::KeyPoint > KeyPoints
 vector of KeyPoints
 
cv::Mat KeyPointsDescriptors
 KeyPoints descriptors, the storeage details is the same as it in OpenCV the details can be seen in OpenCV documents.
 
DBoW2::BowVector BoWDescriptors
 the Bag of Words descriptor of the current frame.
 
int MapID = -1
 this variable indicate which submap this frame belong.
 

Protected Types

using MapPointInfo = std::tuple< std::weak_ptr< MapPointObject >, Eigen::Vector4d, int >
 

Protected Attributes

int FrameID
 
uint32_t Timestamp
 
RelatedFrameInfo::Ptr BestCamera
 pointer of the related frame, the pose of related frame, the pose confidence of related frame (-1 means invalid)
 
std::map< int, RelatedFrameInfo::PtrRelatedFrame
 int is the frame ID, the second is the related frame pointer. the related frame pose might inaccurate once the global pose is found.
 
std::map< int, MapPointInfo > ObservedMapPoints
 
bool KnownPose = false
 

Friends

std::ostream & operator<< (std::ostream &os, FrameObject &frame)
 

Additional Inherited Members

- Protected Member Functions inherited from MVSObject
bool isDirExist (std::string path)
 check if the directory is exist. More...
 
bool mkdir (std::string path)
 create directory in given path. More...
 

Constructor & Destructor Documentation

◆ FrameObject()

FrameObject::FrameObject ( int  ID,
uint32_t  Timestamp = 0 
)

Construct a new Frame Object object.

Parameters
IDunique frame ID

Member Function Documentation

◆ addMapPoint()

bool FrameObject::addMapPoint ( int  KeyPointID,
std::shared_ptr< MapPointObject MapPoint,
const Eigen::Vector4d &  LocalCoordinate 
)

add frame observed map point

Parameters
KeyPointIDmap point related key point ID
MapPointPointer of map point
LocalCoordinatemap point coordinate in the current camera frame
Returns
true add successfully
false add failed

◆ addRelatedFrame()

bool FrameObject::addRelatedFrame ( RelatedFrameInfo::Ptr  FramePtr)

add relate frame, the related frame is the frame with common field of view, it may because the two frames have matched feature points, or because the two frames are created from an dual cameras, or RGBD camera.

Parameters
FramePtrthe shared pointer of related frame.
Returns
true the frame is successfully created.
false failed to create the frame, may because the related frame already exist.

◆ Create() [1/2]

FrameObject::Ptr FrameObject::Create ( int  ID,
int  MapID,
const cv::Mat &  RGBMat,
uint32_t  Timestamp = 0,
const cv::Mat &  XYZMat = cv::Mat() 
)
static

Create FrameObject object.

Parameters
IDUnique frame ID
themap ID, which is assigned by GlobalMap
RGBMatthe undistorted RGB image.
XYZMapthe XYZ map or depth map, the RGBD camera may already compute the original depth map when frame is created.
Returns
Ptr

◆ Create() [2/2]

FrameObject::Ptr FrameObject::Create ( int  ID,
int  MapID,
uint32_t  Timestamp = 0 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
ID
Returns
Ptr

◆ getAllMappointID()

bool FrameObject::getAllMappointID ( std::set< int > &  KeyPointID)

get all keypoint id related to mappoint.

Parameters
KeyPointIDoutput set of keypoint ID.
Returns
if get KeyPointID

◆ getAllRelatedFrames() [1/2]

bool FrameObject::getAllRelatedFrames ( std::set< int > &  FrameID)

get all the related frame id.

Parameters
FrameID
Returns

◆ getAllRelatedFrames() [2/2]

bool FrameObject::getAllRelatedFrames ( std::set< RelatedFrameInfo::Ptr > &  Frames)

Get all the Related Frames object.

Parameters
Framesarray of the shared pointer of the frame
Returns
true has related frames
false do NOT have related frames

◆ getBestFrame()

FrameObject::RelatedFrameInfo::Ptr FrameObject::getBestFrame ( )

get the best frame.

Returns
the shared pointer of the best frame, the pointer will be empty when no frame exist.

◆ getID()

int FrameObject::getID ( )

Get the Frame ID.

Returns
int Frame ID

◆ getMapPoint() [1/2]

bool FrameObject::getMapPoint ( int  KeyPointID,
int &  MappointID,
Eigen::Vector4d &  LocalCoordinate 
)

get mappoint id related to keypoint.

Parameters
KeyPointID
Returns

◆ getMapPoint() [2/2]

bool FrameObject::getMapPoint ( int  KeyPointID,
std::shared_ptr< MapPointObject > &  MapPoint,
Eigen::Vector4d &  LocalCoordinate 
)

Get the Map Point object.

Parameters
KeyPointIDinput key point ID
MapPointoutput map point pointer
LocalCoordinateoutput map point coordinate in local frame
Returns
true get successfully
false get failed

◆ getRelatedFrame()

FrameObject::RelatedFrameInfo::Ptr FrameObject::getRelatedFrame ( int  FrameID)

Get the Related Frame object.

Parameters
FrameIDframe ID
Returns
FrameObject::Ptr the shared pointer of the frame

◆ getTimestamp()

uint32_t FrameObject::getTimestamp ( )

Get the timestamp.

Returns
uint32 timestamp

◆ load()

bool FrameObject::load ( JsonNode &  fs)
overridevirtual

load data and settings from file

this method will load data such as keypoints, descriptors, translation matrices in DataFlowObject and its sub-classes from the given JsonNode instance. or will load parameters and settings in WorkFlowObject and its sub-classes to the given JsonNode instance, and automatically initialize the WorkFlow with these parameters

Parameters
fsthe json handler
Returns
true load successfully
false load failed or initialization falied.

Implements MVSObject.

Reimplemented in PinholeFrameObject.

◆ removeAllMapPoints()

bool FrameObject::removeAllMapPoints ( )

remove all map points

Returns
true remove successfully
false remove failed

◆ removeAllRelatedFrames()

bool FrameObject::removeAllRelatedFrames ( )

remove all of the related camera frame of current frame.

Returns
true remove successfully
false remove failed, the current frame has no related camera frame.

◆ removeMapPoint()

bool FrameObject::removeMapPoint ( int  KeyPointID)

remove map point from frame

Parameters
KeyPointIDthe map point related keypoint ID
Returns
true remove successfully
false remove failed

◆ removeRelatedFrame()

bool FrameObject::removeRelatedFrame ( int  FrameID)

remove the related camera frame, the related camera frame is the frame which has the common filed of view with current frame.

Parameters
FrameIDthe ID of the frame to be removed
Returns
true remove successfully
false remove failed, the frame is not in the related camera frame list.

◆ save()

bool FrameObject::save ( JsonNode &  fs)
overridevirtual

save data and settings to file

this method will save data such as keypoints, descriptors, translation matrices in DataFlowObject and its sub-classes to the given JsonNode instance, or will save parameters and settings in WorkFlowObject and its sub-classes to the given JsonNode instance.

Parameters
fsthe json handler
Returns
true save successfully
false save failed

Implements MVSObject.

Reimplemented in PinholeFrameObject.

◆ setBestFrame()

bool FrameObject::setBestFrame ( RelatedFrameInfo::Ptr  FramePtr)

set the best frame, the best camera pair is the camera that will be used during dual camera dense reconstruction. the best frame should be set after pose reconstruction in mono camera scenario, or be set when the frame is generated in dual camera or RGBD camera scenario.

Parameters
theshared pointer of best frame.
Returns
wether created succeefully.

◆ setTimestamp()

bool FrameObject::setTimestamp ( uint32_t  time)

set the timestamp.

Parameters
timethe new timestamp

◆ type_name()

std::string FrameObject::type_name ( )
overridevirtual

get the typename.

Returns

Reimplemented from MVSObject.

Reimplemented in PinholeFrameObject.

◆ updateMapPoint()

bool FrameObject::updateMapPoint ( int  KeyPointID,
std::shared_ptr< MapPointObject MapPoint,
const Eigen::Vector4d &  LocalCoordinate 
)

update the map point

Parameters
KeyPointIDinput key point ID
MapPointinput map point pointer
LocalCoordinateinput mappoint coordinate
Returns
true update successfully
false update failed, may because input error, and may also because of the map point dose NOT exsit in the frame

◆ updateRelatedFrame()

bool FrameObject::updateRelatedFrame ( RelatedFrameInfo::Ptr  FramePtr)

update related frame.

Parameters
FramePtr
Returns

The documentation for this class was generated from the following files: