-
-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
200dfe0
commit 2800d71
Showing
7 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/aliceVision/sfm/pipeline/expanding/ExpansionPostProcess.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2024 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include <aliceVision/types.hpp> | ||
#include <aliceVision/sfmData/SfMData.hpp> | ||
#include <aliceVision/track/TracksHandler.hpp> | ||
|
||
namespace aliceVision { | ||
namespace sfm { | ||
|
||
class ExpansionPostProcess | ||
{ | ||
public: | ||
using uptr = std::unique_ptr<ExpansionPostProcess>; | ||
|
||
public: | ||
|
||
/** | ||
* @brief Perform post process for an iteration | ||
* @param sfmData the scene to process | ||
* @param tracksHandler the tracks for this scene | ||
* @return true if the process succeeded | ||
*/ | ||
virtual bool process(sfmData::SfMData & sfmData, track::TracksHandler & tracksHandler) = 0; | ||
|
||
/** | ||
* @brief get updated views during process | ||
* @return a set of updated views | ||
*/ | ||
const std::set<IndexT> & getUpdatedViews() const | ||
{ | ||
return _updatedViews; | ||
} | ||
|
||
protected: | ||
std::set<IndexT> _updatedViews; | ||
}; | ||
|
||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/aliceVision/sfm/pipeline/expanding/ExpansionPostProcessRig.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2024 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#include <aliceVision/sfm/pipeline/expanding/ExpansionPostProcessRig.hpp> | ||
#include <aliceVision/sfm/pipeline/RigSequence.hpp> | ||
|
||
namespace aliceVision { | ||
namespace sfm { | ||
|
||
bool ExpansionPostProcessRig::process(sfmData::SfMData & sfmData, track::TracksHandler & tracksHandler) | ||
{ | ||
RigParams params; | ||
params.useRigConstraint = true; | ||
params.minNbCamerasForCalibration = _minNumberCameras; | ||
_updatedViews.clear(); | ||
|
||
if (sfmData.getRigs().empty()) | ||
{ | ||
return false; | ||
} | ||
|
||
/*Calibrate all rigs*/ | ||
int countInit = 0; | ||
for (const auto & [rigId, rigObject] : sfmData.getRigs()) | ||
{ | ||
if (rigObject.isInitialized()) | ||
{ | ||
continue; | ||
} | ||
|
||
RigSequence sequence(sfmData, rigId, params); | ||
sequence.init(tracksHandler.getTracksPerView()); | ||
sequence.updateSfM(_updatedViews); | ||
|
||
countInit++; | ||
} | ||
|
||
if (countInit == 0) | ||
{ | ||
return false; | ||
} | ||
|
||
|
||
return true; | ||
} | ||
|
||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/aliceVision/sfm/pipeline/expanding/ExpansionPostProcessRig.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2024 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include <aliceVision/sfm/pipeline/expanding/ExpansionPostProcess.hpp> | ||
|
||
namespace aliceVision { | ||
namespace sfm { | ||
|
||
class ExpansionPostProcessRig : public ExpansionPostProcess | ||
{ | ||
public: | ||
using uptr = std::unique_ptr<ExpansionPostProcessRig>; | ||
|
||
public: | ||
|
||
/** | ||
* @brief Perform post process for an iteration | ||
* @param sfmData the scene to process | ||
* @param tracksHandler the tracks for this scene | ||
* @return true if the process succeeded | ||
*/ | ||
bool process(sfmData::SfMData & sfmData, track::TracksHandler & tracksHandler) override; | ||
|
||
/** | ||
* @brief update the required number of cameras for rig resection | ||
* param count the desired minimal value | ||
*/ | ||
void setMinimalNumberCameras(std::size_t count) | ||
{ | ||
_minNumberCameras = count; | ||
} | ||
|
||
private: | ||
std::size_t _minNumberCameras = 20; | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters