Skip to content

Commit

Permalink
camera pose lock I/O
Browse files Browse the repository at this point in the history
  • Loading branch information
servantftechnicolor committed Apr 4, 2024
1 parent 922345d commit 44bfb3b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/aliceVision/sfmDataIO/jsonIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,8 @@ inline void loadPose3(const std::string& name, geometry::Pose3& pose, bpt::ptree
inline void saveCameraPose(const std::string& name, const sfmData::CameraPose& cameraPose, bpt::ptree& parentTree)
{
bpt::ptree cameraPoseTree;

savePose3("transform", cameraPose.getTransform(), cameraPoseTree);
cameraPoseTree.put(
"locked", static_cast<int>(cameraPose.isLocked())); // convert bool to integer to avoid using "true/false" in exported file instead of "1/0".

cameraPoseTree.put("locked", cameraPose.isLocked());
parentTree.add_child(name, cameraPoseTree);
}

Expand All @@ -122,13 +119,20 @@ inline void loadCameraPose(const std::string& name, sfmData::CameraPose& cameraP
{
geometry::Pose3 pose;

loadPose3(name + ".transform", pose, cameraPoseTree);
bpt::ptree & poseTree = cameraPoseTree.get_child(name);

loadPose3("transform", pose, poseTree);

cameraPose.setTransform(pose);

if (cameraPoseTree.get<int>("locked", 0))
if (poseTree.get<bool>("locked", false))
{
cameraPose.lock();
}
else
{
cameraPose.unlock();
}
}

/**
Expand Down

0 comments on commit 44bfb3b

Please sign in to comment.