Skip to content

Commit

Permalink
Merge branch 'develop' into rperrot-code_cleanup
Browse files Browse the repository at this point in the history
Conflicts:
	src/openMVG/tracks/tracks.hpp
  • Loading branch information
pmoulon committed Apr 20, 2016
2 parents 16f3195 + c46ef2a commit 395ab2b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
12 changes: 8 additions & 4 deletions src/openMVG/sfm/pipelines/sequential/sequential_SfM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ bool SequentialSfMReconstructionEngine::Process() {
{
BundleAdjustment();
}
while (badTrackRejector(4.0, 50) != 0);
while (badTrackRejector(4.0, 50));
eraseUnstablePosesAndObservations(sfm_data_);
}
++resectionGroupIndex;
}
// Ensure there is no remaining outliers
badTrackRejector(4.0, 0);
if (badTrackRejector(4.0, 0))
{
eraseUnstablePosesAndObservations(sfm_data_);
}

//-- Reconstruction done.
//-- Display some statistics
Expand Down Expand Up @@ -333,7 +337,7 @@ bool SequentialSfMReconstructionEngine::InitLandmarkTracks()
bool SequentialSfMReconstructionEngine::AutomaticInitialPairChoice(Pair & initial_pair) const
{
// From the k view pairs with the highest number of verified matches
// select a pair that have the largest basline (mean angle between it's bearing vectors).
// select a pair that have the largest baseline (mean angle between it's bearing vectors).

const unsigned k = 20;
const unsigned iMin_inliers_count = 100;
Expand Down Expand Up @@ -1237,7 +1241,7 @@ bool SequentialSfMReconstructionEngine::BundleAdjustment()
*
* @return True if more than 'count' outliers have been removed.
*/
size_t SequentialSfMReconstructionEngine::badTrackRejector(double dPrecision, size_t count)
bool SequentialSfMReconstructionEngine::badTrackRejector(double dPrecision, size_t count)
{
const size_t nbOutliers_residualErr = RemoveOutliers_PixelResidualError(sfm_data_, dPrecision, 2);
const size_t nbOutliers_angleErr = RemoveOutliers_AngleError(sfm_data_, 2.0);
Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/sfm/pipelines/sequential/sequential_SfM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SequentialSfMReconstructionEngine : public ReconstructionEngine
bool BundleAdjustment();

/// Discard track with too large residual error
size_t badTrackRejector(double dPrecision, size_t count = 0);
bool badTrackRejector(double dPrecision, size_t count = 0);

//----
//-- Data
Expand Down
49 changes: 32 additions & 17 deletions src/openMVG/tracks/tracks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ struct TracksUtilsMap
* @param[in] map_tracksIn: all tracks of the scene
* @param[out] map_tracksOut: output with only the common tracks
*/
static bool GetTracksInImages(
static bool GetTracksInImages
(
const std::set<size_t> & set_imageIndex,
const STLMAPTracks & map_tracksIn,
STLMAPTracks & map_tracksOut)
STLMAPTracks & map_tracksOut
)
{
map_tracksOut.clear();

Expand All @@ -242,9 +244,11 @@ struct TracksUtilsMap
}

/// Return the tracksId as a set (sorted increasing)
static void GetTracksIdVector(
static void GetTracksIdVector
(
const STLMAPTracks & map_tracks,
std::set<size_t> * set_tracksIds)
std::set<size_t> * set_tracksIds
)
{
set_tracksIds->clear();
for ( const auto & iterT : map_tracks )
Expand All @@ -254,20 +258,22 @@ struct TracksUtilsMap
}

/// Get feature index PerView and TrackId
static bool GetFeatIndexPerViewAndTrackId(
static bool GetFeatIndexPerViewAndTrackId
(
const STLMAPTracks & map_tracks,
const std::set<size_t> & set_trackId,
size_t nImageIndex,
std::vector<size_t> * pvec_featIndex)
std::vector<size_t> * pvec_featIndex
)
{
for ( const auto & iterT : map_tracks )
for (const size_t & trackId: set_trackId)
{
const size_t trackId = iterT.first;
if (set_trackId.find(trackId) != set_trackId.end())
STLMAPTracks::const_iterator iterT = map_tracks.find(trackId);
if (iterT != map_tracks.end())
{
//try to find imageIndex
const submapTrack & map_ref = iterT.second;
auto iterSearch = map_ref.find(nImageIndex);
const submapTrack & map_ref = iterT->second;
submapTrack::const_iterator iterSearch = map_ref.find(nImageIndex);
if (iterSearch != map_ref.end())
{
pvec_featIndex->emplace_back(iterSearch->second);
Expand Down Expand Up @@ -299,9 +305,12 @@ struct TracksUtilsMap
* @warning The input tracks must be composed of only two images index.
* @warning Image index are considered sorted (increasing order).
*/
static void TracksToIndexedMatches(const STLMAPTracks & map_tracks,
static void TracksToIndexedMatches
(
const STLMAPTracks & map_tracks,
const std::vector<IndexT> & vec_filterIndex,
std::vector<IndMatch> * pvec_index)
std::vector<IndMatch> * pvec_index
)
{

std::vector<IndMatch> & vec_indexref = *pvec_index;
Expand All @@ -324,8 +333,11 @@ struct TracksUtilsMap
}

/// Return the occurrence of tracks length.
static void TracksLength(const STLMAPTracks & map_tracks,
std::map<size_t, size_t> & map_Occurence_TrackLength)
static void TracksLength
(
const STLMAPTracks & map_tracks,
std::map<size_t, size_t> & map_Occurence_TrackLength
)
{
for ( const auto & iterT : map_tracks )
{
Expand All @@ -343,8 +355,11 @@ struct TracksUtilsMap
}

/// Return a set containing the image Id considered in the tracks container.
static void ImageIdInTracks(const STLMAPTracks & map_tracks,
std::set<size_t> & set_imagesId)
static void ImageIdInTracks
(
const STLMAPTracks & map_tracks,
std::set<size_t> & set_imagesId
)
{
for ( const auto & iterT : map_tracks )
{
Expand Down

0 comments on commit 395ab2b

Please sign in to comment.