From 1ff56df5a160d2b9843ff9f15d580d548a865bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Fri, 8 Sep 2023 13:47:07 +0200 Subject: [PATCH] [sfmDataIO] remove poseId validation --- src/aliceVision/sfmDataIO/sfmDataIO.cpp | 33 +++---------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/aliceVision/sfmDataIO/sfmDataIO.cpp b/src/aliceVision/sfmDataIO/sfmDataIO.cpp index 25ea085046..d240fef206 100644 --- a/src/aliceVision/sfmDataIO/sfmDataIO.cpp +++ b/src/aliceVision/sfmDataIO/sfmDataIO.cpp @@ -25,36 +25,26 @@ namespace fs = boost::filesystem; namespace aliceVision { namespace sfmDataIO { -///Check that each pose have a valid intrinsic and pose id in the existing View ids +///Check that each view references a declared intrinsic bool ValidIds(const sfmData::SfMData& sfmData, ESfMData partFlag) { const bool bCheck_Intrinsic = (partFlag & INTRINSICS); - const bool bCheck_Extrinsic = (partFlag & EXTRINSICS); std::set intrinsicIdsDeclared; transform(sfmData.getIntrinsics().begin(), sfmData.getIntrinsics().end(), std::inserter(intrinsicIdsDeclared, intrinsicIdsDeclared.begin()), stl::RetrieveKey()); - std::set extrinsicIdsDeclared; //unique so can use a set - transform(sfmData.getPoses().begin(), sfmData.getPoses().end(), - std::inserter(extrinsicIdsDeclared, extrinsicIdsDeclared.begin()), stl::RetrieveKey()); - - // Collect id_intrinsic and id_extrinsic referenced from views + // Collect id_intrinsic referenced from views std::set intrinsicIdsReferenced; - std::set extrinsicIdsReferenced; for(const auto& v: sfmData.getViews()) { const IndexT id_intrinsic = v.second.get()->getIntrinsicId(); intrinsicIdsReferenced.insert(id_intrinsic); - - const IndexT id_pose = v.second.get()->getPoseId(); - extrinsicIdsReferenced.insert(id_pose); } // We may have some views with undefined Intrinsics, // so erase the UndefinedIndex value if exist. intrinsicIdsReferenced.erase(UndefinedIndexT); - extrinsicIdsReferenced.erase(UndefinedIndexT); // Check if defined intrinsic & extrinsic are at least connected to views bool bRet = true; @@ -73,21 +63,6 @@ bool ValidIds(const sfmData::SfMData& sfmData, ESfMData partFlag) if(!undefinedIntrinsicIds.empty()) bRet = false; // error } - - if (bCheck_Extrinsic && extrinsicIdsDeclared != extrinsicIdsReferenced) - { - ALICEVISION_LOG_TRACE(extrinsicIdsDeclared.size() << " extrinsics declared and " << extrinsicIdsReferenced.size() << " extrinsics used."); - std::set undefinedExtrinsicIds; - // undefinedExtrinsicIds = extrinsicIdsReferenced - extrinsicIdsDeclared - std::set_difference(extrinsicIdsDeclared.begin(), extrinsicIdsDeclared.end(), - extrinsicIdsReferenced.begin(), extrinsicIdsReferenced.end(), - std::inserter(undefinedExtrinsicIds, undefinedExtrinsicIds.begin())); - // If undefinedExtrinsicIds is not empty, - // some extrinsics are used in Views but never declared. - // So the file structure is invalid and may create troubles. - if(!undefinedExtrinsicIds.empty()) - bRet = false; // error - } return bRet; } @@ -123,8 +98,8 @@ bool Load(sfmData::SfMData& sfmData, const std::string& filename, ESfMData partF if(status) sfmData.setAbsolutePath(filename); - // Assert that loaded intrinsics | extrinsics are linked to valid view - if(status && (partFlag & VIEWS) && ((partFlag & INTRINSICS) || (partFlag & EXTRINSICS))) + // Assert that loaded intrinsics are linked to valid view + if(status && (partFlag & VIEWS) && (partFlag & INTRINSICS)) return ValidIds(sfmData, partFlag); return status;