Skip to content

Commit 626b2be

Browse files
author
Fabien Servant
committed
globalRotation app
1 parent f1d5025 commit 626b2be

File tree

10 files changed

+140356
-3
lines changed

10 files changed

+140356
-3
lines changed

src/aliceVision/sfmData/CameraPose.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,27 @@ class CameraPose
7979

8080
void setState(EEstimatorParameterState state) { _state = state; }
8181

82+
bool isRotationOnly() const
83+
{
84+
return _rotationOnly;
85+
}
86+
87+
/**
88+
* Set the flag for partial state
89+
* Partial flag set to on means the camera translation is not known
90+
*/
91+
void setRotationOnly(bool partial)
92+
{
93+
_rotationOnly = partial;
94+
}
95+
8296
private:
8397
/// camera 3d transformation
8498
geometry::Pose3 _transform;
8599
/// camera lock
86100
bool _locked = false;
101+
/// Only rotation is solved
102+
bool _rotationOnly = false;
87103
/// Estimator state
88104
EEstimatorParameterState _state = EEstimatorParameterState::REFINED;
89105
};

src/aliceVision/sfmData/SfMData.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ class SfMData
310310
return false;
311311
}
312312

313+
if (it->second.isRotationOnly())
314+
{
315+
return false;
316+
}
317+
313318
bool rigValid = ((!view.isPartOfRig() || view.isPoseIndependant() || getRigSubPose(view).status != ERigSubPoseStatus::UNINITIALIZED));
314319
if (!rigValid)
315320
{

src/aliceVision/sfmDataIO/AlembicExporter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void AlembicExporter::DataImpl::addCamera(const std::string& name,
111111
if (pose != nullptr)
112112
{
113113
OBoolProperty(userProps, "mvg_poseLocked").set(pose->isLocked());
114+
OBoolProperty(userProps, "mvg_rotationOnly").set(pose->isRotationOnly());
114115

115116
// Convert from computer vision convention to computer graphics (opengl-like)
116117
Eigen::Matrix4d M = Eigen::Matrix4d::Identity();
@@ -397,7 +398,7 @@ void AlembicExporter::addSfMSingleCamera(const sfmData::SfMData& sfmData, const
397398
const std::shared_ptr<camera::IntrinsicBase> intrinsic =
398399
(flagsPart & ESfMData::INTRINSICS) ? sfmData.getIntrinsicSharedPtr(view.getIntrinsicId()) : nullptr;
399400

400-
if (sfmData.isPoseAndIntrinsicDefined(&view) && (flagsPart & ESfMData::EXTRINSICS))
401+
if (sfmData.isPoseAndIntrinsicDefined(view) && (flagsPart & ESfMData::EXTRINSICS))
401402
_dataImpl->addCamera(name, view, pose, intrinsic, nullptr, &_dataImpl->_mvgCameras);
402403
else
403404
_dataImpl->addCamera(name, view, pose, intrinsic, nullptr, &_dataImpl->_mvgCamerasUndefined);

src/aliceVision/sfmDataIO/AlembicImporter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ bool readCamera(const Version& abcVersion,
417417
IndexT resectionId = UndefinedIndexT;
418418
bool intrinsicLocked = false;
419419
bool poseLocked = false;
420+
bool rotationOnly = false;
420421
bool poseIndependant = true;
421422
bool lockRatio = true;
422423
bool lockOffset = false;
@@ -489,6 +490,10 @@ bool readCamera(const Version& abcVersion,
489490
{
490491
poseLocked = getAbcProp<Alembic::Abc::IBoolProperty>(userProps, *propHeader, "mvg_poseLocked", sampleFrame);
491492
}
493+
if (const Alembic::Abc::PropertyHeader* propHeader = userProps.getPropertyHeader("mvg_rotationOnly"))
494+
{
495+
rotationOnly = getAbcProp<Alembic::Abc::IBoolProperty>(userProps, *propHeader, "mvg_rotationOnly", sampleFrame);
496+
}
492497
if (const Alembic::Abc::PropertyHeader* propHeader = userProps.getPropertyHeader("mvg_poseIndependant"))
493498
{
494499
poseIndependant = getAbcProp<Alembic::Abc::IBoolProperty>(userProps, *propHeader, "mvg_poseIndependant", sampleFrame);
@@ -805,7 +810,9 @@ bool readCamera(const Version& abcVersion,
805810
}
806811
else
807812
{
808-
sfmData.setPose(*view, sfmData::CameraPose(pose, poseLocked));
813+
sfmData::CameraPose cp(pose, poseLocked);
814+
cp.setRotationOnly(rotationOnly);
815+
sfmData.setPose(*view, cp);
809816
}
810817
}
811818

429 KB
Binary file not shown.

0 commit comments

Comments
 (0)