GUI: Added Multi-Session Localization view. CameraModel: set localTransform to optical rotation in default constructor (fixed matrix invertion errors with code ignoring setting local transform), save/read local transform in/from camera calibration yaml file (so that local transform is also exported when extracting rgb/depth images). Rtabmap: in localization mode, ignore landmarks farther than RGBD/LocalRadius if no global loop closures are already in odometry cache.

This commit is contained in:
matlabbe
2022-02-12 13:35:23 -05:00
parent f584f42ea4
commit 191e165a28
13 changed files with 612 additions and 24 deletions
+30 -1
View File
@@ -37,7 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace rtabmap {
CameraModel::CameraModel()
CameraModel::CameraModel() :
localTransform_(opticalRotation())
{
}
@@ -339,6 +340,25 @@ bool CameraModel::load(const std::string & filePath)
UWARN("Missing \"projection_matrix\" field in \"%s\"", filePath.c_str());
}
n = fs["local_transform"];
if(n.type() != cv::FileNode::NONE)
{
int rows = (int)n["rows"];
int cols = (int)n["cols"];
std::vector<float> data;
n["data"] >> data;
UASSERT(rows*cols == (int)data.size());
UASSERT(rows == 3 && cols == 4);
localTransform_ = Transform(
data[0], data[1], data[2], data[3],
data[4], data[5], data[6], data[7],
data[8], data[9], data[10], data[11]);
}
else
{
UWARN("Missing \"local_transform\" field in \"%s\"", filePath.c_str());
}
fs.release();
if(isValidForRectification())
@@ -448,6 +468,15 @@ bool CameraModel::save(const std::string & directory) const
fs << "}";
}
if(!localTransform_.isNull())
{
fs << "local_transform" << "{";
fs << "rows" << 3;
fs << "cols" << 4;
fs << "data" << std::vector<float>((float*)localTransform_.data(), ((float*)localTransform_.data())+12);
fs << "}";
}
fs.release();
return true;