Skip to content

Commit 8460e58

Browse files
author
Fabien Servant
committed
wip
1 parent 79fa3cf commit 8460e58

File tree

7 files changed

+41
-7
lines changed

7 files changed

+41
-7
lines changed

meshroom/aliceVision/ImageMatching.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ class ImageMatching(desc.AVCommandLineNode):
6363
" - SequentialAndVocabularyTree: Combines sequential approach with VocTree to enable connections between keyframes at different times.\n"
6464
" - Exhaustive: Export all image pairs.\n"
6565
" - Frustum: If images have known poses, computes the intersection between cameras frustums to create the list of image pairs.\n"
66-
" - FrustumOrVocabularyTree: If images have known poses, use frustum intersection else use VocabularyTree.\n",
66+
" - FrustumOrVocabularyTree: If images have known poses, use frustum intersection else use VocabularyTree.\n"
67+
" - Mirror: Try to match images with themselves. \n",
6768
value="SequentialAndVocabularyTree",
68-
values=["VocabularyTree", "Sequential", "SequentialAndVocabularyTree", "Exhaustive", "Frustum", "FrustumOrVocabularyTree"],
69+
values=["VocabularyTree", "Sequential", "SequentialAndVocabularyTree", "Exhaustive", "Frustum", "FrustumOrVocabularyTree", "Mirror"],
6970
),
7071
desc.File(
7172
name="tree",

src/aliceVision/feature/feature.i

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
%include <aliceVision/config.hpp>
1010
%include <aliceVision/global.i>
1111

12+
namespace std
13+
{
14+
#ifdef LINUXPLATFORM
15+
typedef long unsigned int size_t;
16+
#else
17+
typedef long unsigned long size_t;
18+
#endif
19+
}
20+
1221
%{
1322
#include <aliceVision/feature/Regions.hpp>
1423
#include <aliceVision/feature/imageDescriberCommon.hpp>

src/aliceVision/imageMatching/ImageMatching.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ std::string EImageMatchingMethod_enumToString(EImageMatchingMethod m)
4040
return "Frustum";
4141
case EImageMatchingMethod::FRUSTUM_OR_VOCABULARYTREE:
4242
return "FrustumOrVocabularyTree";
43+
case EImageMatchingMethod::MIRROR:
44+
return "Mirror";
4345
}
4446
throw std::out_of_range("Invalid EImageMatchingMethod enum: " + std::to_string(int(m)));
4547
}
@@ -61,6 +63,8 @@ EImageMatchingMethod EImageMatchingMethod_stringToEnum(const std::string& m)
6163
return EImageMatchingMethod::FRUSTUM;
6264
if (mode == "frustumorvocabularytree")
6365
return EImageMatchingMethod::FRUSTUM_OR_VOCABULARYTREE;
66+
if (mode == "mirror")
67+
return EImageMatchingMethod::MIRROR;
6468

6569
throw std::out_of_range("Invalid EImageMatchingMethod: " + m);
6670
}
@@ -185,6 +189,14 @@ void generateSequentialMatches(const sfmData::SfMData& sfmData, size_t nbMatches
185189
}
186190
}
187191

192+
void generateMirrorsMatches(const sfmData::SfMData& sfmData, OrderedPairList& outPairList)
193+
{
194+
for (const auto& [index, _] : sfmData.getViews())
195+
{
196+
outPairList[index].insert(index);
197+
}
198+
}
199+
188200
void generateAllMatchesInOneMap(const std::set<IndexT>& viewIds, OrderedPairList& outPairList)
189201
{
190202
for (const IndexT imgA : viewIds)

src/aliceVision/imageMatching/ImageMatching.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ enum class EImageMatchingMethod
5454
SEQUENTIAL = 2,
5555
SEQUENTIAL_AND_VOCABULARYTREE = 3,
5656
FRUSTUM = 4,
57-
FRUSTUM_OR_VOCABULARYTREE = 5
57+
FRUSTUM_OR_VOCABULARYTREE = 5,
58+
MIRROR = 6,
5859
};
5960

6061
/**
@@ -116,6 +117,7 @@ EImageMatchingMode EImageMatchingMode_stringToEnum(const std::string& modeMultiS
116117
void convertAllMatchesToPairList(const PairList& allMatches, std::size_t numMatches, OrderedPairList& outPairList);
117118

118119
void generateSequentialMatches(const sfmData::SfMData& sfmData, size_t nbMatches, OrderedPairList& outPairList);
120+
void generateMirrorsMatches(const sfmData::SfMData& sfmData, OrderedPairList& outPairList);
119121
void generateAllMatchesInOneMap(const std::set<IndexT>& viewIds, OrderedPairList& outPairList);
120122
void generateAllMatchesBetweenTwoMap(const std::set<IndexT>& viewIdsA, const std::set<IndexT>& viewIdsB, OrderedPairList& outPairList);
121123

src/aliceVision/matchingImageCollection/ImagePairListIO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ bool loadPairs(std::istream& stream, PairSet& pairs, int rangeStart, int rangeSi
5151
oss >> J;
5252
if (I == J)
5353
{
54-
ALICEVISION_LOG_WARNING("loadPairs: Invalid input file. Image " << I << " sees itself.");
55-
return false;
54+
//ALICEVISION_LOG_WARNING("loadPairs: Invalid input file. Image " << I << " sees itself.");
55+
//return false;
5656
}
5757
Pair pairToInsert;
5858

src/software/pipeline/main_geometricFilterEstimating.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int aliceVision_main(int argc, char** argv)
123123
ALICEVISION_LOG_ERROR("Unable to load matches.");
124124
return EXIT_FAILURE;
125125
}
126-
126+
127127
int chunkStart, chunkEnd;
128128
if (!rangeComputation(chunkStart, chunkEnd, rangeIteration, rangeBlocksCount, pairwiseMatches.size()))
129129
{
@@ -172,7 +172,7 @@ int aliceVision_main(int argc, char** argv)
172172
ALICEVISION_LOG_INFO(std::to_string(filteredMatches.size()) << " putative image pair matches");
173173
for (const auto& imageMatch : filteredMatches)
174174
{
175-
ALICEVISION_LOG_INFO("\t- image pair (" << imageMatch.first.first + ", " << imageMatch.first.second << ") contains " << imageMatch.second.getNbAllMatches() << " putative matches.");
175+
ALICEVISION_LOG_INFO("\t- image pair (" << imageMatch.first.first << ", " << imageMatch.first.second << ") contains " << imageMatch.second.getNbAllMatches() << " putative matches.");
176176
}
177177

178178

src/software/pipeline/main_imageMatching.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,16 @@ int aliceVision_main(int argc, char** argv)
191191

192192
switch (method)
193193
{
194+
case EImageMatchingMethod::MIRROR:
195+
if (!useMultiSfM)
196+
{
197+
generateMirrorsMatches(sfmDataA, selectedPairs);
198+
}
199+
else
200+
{
201+
ALICEVISION_THROW_ERROR("Invalid mirror mode for multisfm");
202+
}
203+
break;
194204
case EImageMatchingMethod::EXHAUSTIVE:
195205
{
196206
ALICEVISION_LOG_INFO("Use EXHAUSTIVE method.");

0 commit comments

Comments
 (0)