Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix alembic I/O #1744

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/aliceVision/sfmDataIO/AlembicExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ void AlembicExporter::DataImpl::addCamera(const std::string& name,
OStringProperty(userProps, "mvg_intrinsicType").set(intrinsicCasted->getTypeStr());
OStringProperty(userProps, "mvg_intrinsicInitializationMode").set(camera::EInitMode_enumToString(intrinsicCasted->getInitializationMode()));
ODoubleProperty(userProps, "mvg_initialFocalLength").set(initialFocalLength);
OStringProperty(userProps, "mvg_intrinsicSerialNumber").set(intrinsicCasted->serialNumber());
OBoolProperty(userProps, "mvg_intrinsicLocked").set(intrinsicCasted->isLocked());
OBoolProperty(userProps, "mvg_intrinsicPixelRatioLocked").set(intrinsicCasted->isRatioLocked());
OBoolProperty(userProps, "mvg_intrinsicOffsetLocked").set(intrinsicCasted->isOffsetLocked());
OBoolProperty(userProps, "mvg_intrinsicScaleLocked").set(intrinsicCasted->isOffsetLocked());
OBoolProperty(userProps, "mvg_intrinsicScaleLocked").set(intrinsicCasted->isScaleLocked());
OStringProperty(userProps, "mvg_intrinsicDistortionInitializationMode")
.set(camera::EInitMode_enumToString(intrinsicCasted->getDistortionInitializationMode()));

Expand Down
6 changes: 6 additions & 0 deletions src/aliceVision/sfmDataIO/AlembicImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ bool readCamera(const Version& abcVersion,
double undistortionDiagonal = 0.0;
double undistortionPixelAspectRatio = 1.0;
bool undistortionDesqueezed = false;
std::string serialNumber = "";

if (userProps)
{
Expand Down Expand Up @@ -464,6 +465,10 @@ bool readCamera(const Version& abcVersion,
{
resectionId = getAbcProp_uint(userProps, *propHeader, "mvg_resectionId", sampleFrame);
}
if (const Alembic::Abc::PropertyHeader* propHeader = userProps.getPropertyHeader("mvg_intrinsicSerialNumber"))
{
serialNumber = getAbcProp<Alembic::Abc::IStringProperty>(userProps, *propHeader, "mvg_intrinsicSerialNumber", sampleFrame);
}
if (const Alembic::Abc::PropertyHeader* propHeader = userProps.getPropertyHeader("mvg_intrinsicLocked"))
{
intrinsicLocked = getAbcProp<Alembic::Abc::IBoolProperty>(userProps, *propHeader, "mvg_intrinsicLocked", sampleFrame);
Expand Down Expand Up @@ -657,6 +662,7 @@ bool readCamera(const Version& abcVersion,
/*width*/ sensorSize_pix.at(0),
/*height*/ sensorSize_pix.at(1));

intrinsic->setSerialNumber(serialNumber);
intrinsic->setSensorWidth(sensorSize_mm.at(0));
intrinsic->setSensorHeight(sensorSize_mm.at(1));
intrinsic->importFromParams(mvg_intrinsicParams, abcVersion);
Expand Down
Loading