Skip to content

Commit

Permalink
- add matching_image_collection cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rperrot committed Apr 19, 2016
1 parent c056631 commit 5ba1cc5
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class Cascade_Hashing_Matcher_Regions_AllInMemory : public Matcher
const std::shared_ptr<sfm::Regions_Provider> & regions_provider,
const Pair_Set & pairs,
matching::PairWiseMatches & map_PutativesMatches // the pairwise photometric corresponding points
)const;
)const override ;

private:
// Distance ratio used to discard spurious correspondence
float f_dist_ratio_;
};

} // namespace openMVG
} // namespace matching_image_collection
} // namespace openMVG
10 changes: 5 additions & 5 deletions src/openMVG/matching_image_collection/E_ACRobust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ struct GeometricFilter_EMatrix_AC
Mat3>
KernelType;

const cameras::Pinhole_Intrinsic * ptrPinhole_I = (const cameras::Pinhole_Intrinsic*)(cam_I);
const cameras::Pinhole_Intrinsic * ptrPinhole_J = (const cameras::Pinhole_Intrinsic*)(cam_J);
const cameras::Pinhole_Intrinsic * ptrPinhole_I = dynamic_cast<const cameras::Pinhole_Intrinsic*>(cam_I);
const cameras::Pinhole_Intrinsic * ptrPinhole_J = dynamic_cast<const cameras::Pinhole_Intrinsic*>(cam_J);

KernelType kernel(
xI, sfm_data->GetViews().at(iIndex)->ui_width, sfm_data->GetViews().at(iIndex)->ui_height,
Expand Down Expand Up @@ -149,8 +149,8 @@ struct GeometricFilter_EMatrix_AC
if ( !isPinhole(cam_I->getType()) || !isPinhole(cam_J->getType()))
return false;

const cameras::Pinhole_Intrinsic * ptrPinhole_I = (const cameras::Pinhole_Intrinsic*)(cam_I);
const cameras::Pinhole_Intrinsic * ptrPinhole_J = (const cameras::Pinhole_Intrinsic*)(cam_J);
const cameras::Pinhole_Intrinsic * ptrPinhole_I = dynamic_cast<const cameras::Pinhole_Intrinsic*>(cam_I);
const cameras::Pinhole_Intrinsic * ptrPinhole_J = dynamic_cast<const cameras::Pinhole_Intrinsic*>(cam_J);

Mat3 F;
FundamentalFromEssential(m_E, ptrPinhole_I->K(), ptrPinhole_J->K(), &F);
Expand All @@ -176,6 +176,6 @@ struct GeometricFilter_EMatrix_AC
double m_dPrecision_robust;
};

} // namespace openMVG
} //namespace matching_image_collection
} // namespace openMVG

2 changes: 1 addition & 1 deletion src/openMVG/matching_image_collection/F_ACRobust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@ struct GeometricFilter_FMatrix_AC
double m_dPrecision_robust;
};

} // namespace openMVG
} //namespace matching_image_collection
} // namespace openMVG

4 changes: 2 additions & 2 deletions src/openMVG/matching_image_collection/GeometricFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void ImageCollectionGeometricFilter::Robust_model_estimation
#endif
for (int i = 0; i < (int)putative_matches.size(); ++i)
{
PairWiseMatches::const_iterator iter = putative_matches.begin();
auto iter = putative_matches.begin();
advance(iter,i);

const Pair current_pair = iter->first;
Expand Down Expand Up @@ -104,7 +104,7 @@ void ImageCollectionGeometricFilter::Robust_model_estimation
}
}

} // namespace openMVG
} // namespace matching_image_collection
} // namespace openMVG


16 changes: 11 additions & 5 deletions src/openMVG/matching_image_collection/Geometric_Filter_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

#pragma once

#include "openMVG/features/feature.hpp"
#include "openMVG/matching/indMatch.hpp"
#include "openMVG/sfm/pipelines/sfm_features_provider.hpp"
#include "openMVG/sfm/pipelines/sfm_regions_provider.hpp"


namespace openMVG {
namespace matching_image_collection {

Expand Down Expand Up @@ -76,10 +82,10 @@ void MatchesPairToMat
// Retrieve corresponding pair camera intrinsic if any
const cameras::IntrinsicBase * cam_I =
sfm_data->GetIntrinsics().count(view_I->id_intrinsic) ?
sfm_data->GetIntrinsics().at(view_I->id_intrinsic).get() : NULL;
sfm_data->GetIntrinsics().at(view_I->id_intrinsic).get() : nullptr ;
const cameras::IntrinsicBase * cam_J =
sfm_data->GetIntrinsics().count(view_J->id_intrinsic) ?
sfm_data->GetIntrinsics().at(view_J->id_intrinsic).get() : NULL;
sfm_data->GetIntrinsics().at(view_J->id_intrinsic).get() : nullptr ;

// Load features of Inth and Jnth images
const features::PointFeatures feature_I = regions_provider->regions_per_view.at(pairIndex.first)->GetRegionsPositions();
Expand Down Expand Up @@ -117,10 +123,10 @@ void MatchesPairToMat
// Retrieve corresponding pair camera intrinsic if any
const cameras::IntrinsicBase * cam_I =
sfm_data->GetIntrinsics().count(view_I->id_intrinsic) ?
sfm_data->GetIntrinsics().at(view_I->id_intrinsic).get() : NULL;
sfm_data->GetIntrinsics().at(view_I->id_intrinsic).get() : nullptr ;
const cameras::IntrinsicBase * cam_J =
sfm_data->GetIntrinsics().count(view_J->id_intrinsic) ?
sfm_data->GetIntrinsics().at(view_J->id_intrinsic).get() : NULL;
sfm_data->GetIntrinsics().at(view_J->id_intrinsic).get() : nullptr ;

// Load features of Inth and Jnth images
const features::PointFeatures feature_I = features_provider->feats_per_view.at(pairIndex.first);
Expand All @@ -133,5 +139,5 @@ void MatchesPairToMat
x_I, x_J);
}

} // namespace openMVG
} //namespace matching_image_collection
} // namespace openMVG
2 changes: 1 addition & 1 deletion src/openMVG/matching_image_collection/H_ACRobust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ struct GeometricFilter_HMatrix_AC
double m_dPrecision_robust;
};

} //namespace matching_image_collection
} // namespace openMVG
} //namespace matching_image_collection


6 changes: 3 additions & 3 deletions src/openMVG/matching_image_collection/Matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace matching_image_collection {
class Matcher
{
public:
Matcher() {};
Matcher() = default ;

virtual ~Matcher() {};
virtual ~Matcher() = default ;

/// Find corresponding points between some pair of view Ids
virtual void Match(
Expand All @@ -37,5 +37,5 @@ class Matcher
)const = 0;
};

} // namespace openMVG
} // namespace matching_image_collection
} // namespace openMVG
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Matcher_Regions_AllInMemory : public Matcher
const std::shared_ptr<sfm::Regions_Provider> & regions_provider,
const Pair_Set & pairs,
matching::PairWiseMatches & map_PutativesMatches // the pairwise photometric corresponding points
)const;
)const override ;

private:
// Distance ratio used to discard spurious correspondence
Expand All @@ -42,5 +42,5 @@ class Matcher_Regions_AllInMemory : public Matcher
matching::EMatcherType _eMatcherType;
};

} // namespace openMVG
} // namespace matching_image_collection
} // namespace openMVG
7 changes: 3 additions & 4 deletions src/openMVG/matching_image_collection/Pair_Builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ static bool savePairs(const std::string &sFileName, const Pair_Set & pairs)
<< "savePairs: Impossible to open the output specified file: \"" << sFileName << "\"." << std::endl;
return false;
}
for (Pair_Set::const_iterator iterP = pairs.begin();
iterP != pairs.end(); ++iterP)
{
outStream << iterP->first << ' ' << iterP->second << '\n';
for ( const auto & cur_pair : pairs )
{
outStream << cur_pair.first << ' ' << cur_pair.second << '\n';
}
bool bOk = !outStream.bad();
outStream.close();
Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef std::vector<Pair> Pair_Vec;
#if defined OPENMVG_NO_UNORDERED_MAP
template<typename K, typename V>
struct Hash_Map : std::map<K, V, std::less<K>,
Eigen::aligned_allocator<std::pair<K,V> > > {};
Eigen::aligned_allocator<std::pair<const K,V> > > {};
#endif

#if defined OPENMVG_STD_UNORDERED_MAP
Expand Down

0 comments on commit 5ba1cc5

Please sign in to comment.