Skip to content

Commit cd04d20

Browse files
author
Fabien Servant
committed
wip
1 parent af15f4c commit cd04d20

File tree

13 files changed

+204
-28
lines changed

13 files changed

+204
-28
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
__version__ = "1.0"
2+
3+
from meshroom.core import desc
4+
from meshroom.core.utils import VERBOSE_LEVEL
5+
6+
7+
class GlobalTranslationEstimating(desc.AVCommandLineNode):
8+
commandLine = "aliceVision_globalTranslationEstimating {allParams}"
9+
10+
category = "Sparse Reconstruction"
11+
documentation = """Estimate the global translations given tracks."""
12+
13+
inputs = [
14+
desc.File(
15+
name="input",
16+
label="SfMData",
17+
description="SfMData file.",
18+
value="",
19+
),
20+
desc.File(
21+
name="tracksFilename",
22+
label="Tracks File",
23+
description="Tracks file.",
24+
value="",
25+
),
26+
desc.ChoiceParam(
27+
name="verboseLevel",
28+
label="Verbose Level",
29+
description="Verbosity level (fatal, error, warning, info, debug, trace).",
30+
values=VERBOSE_LEVEL,
31+
value="info",
32+
),
33+
]
34+
35+
outputs = [
36+
desc.File(
37+
name="output",
38+
label="SfMData",
39+
description="Path to the output SfMData file.",
40+
value="{nodeCacheFolder}/sfm.abc",
41+
),
42+
]

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/aliceVision/sfmData/SfMData.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ class SfMData
351351
return false;
352352
}
353353

354-
if (it->second.isRotationOnly())
355-
{
356-
return false;
357-
}
358-
359354
bool rigValid = ((!view.isPartOfRig() || view.isPoseIndependant() || getRigSubPose(view).status != ERigSubPoseStatus::UNINITIALIZED));
360355
if (!rigValid)
361356
{

src/aliceVision/system/Parallelization.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ bool rangeComputation(int & rangeStart, int & rangeEnd, int rangeIteration, int
2525
else
2626
{
2727
// Distribute data among available chunks
28-
int chunkSize = int(std::floor(double(itemsCount) / double(rangeBlocksCount)));
29-
rangeStart = rangeIteration * chunkSize;
30-
rangeEnd = rangeStart + chunkSize;
31-
32-
33-
// Last one will get the reminder
34-
int reminder = itemsCount - rangeEnd;
35-
if (reminder < chunkSize)
36-
{
37-
rangeEnd = itemsCount;
38-
}
28+
int chunkSize = itemsCount / rangeBlocksCount;
29+
int reminder = itemsCount % rangeBlocksCount;
30+
31+
// Reminder is distributed among first iterations
32+
int shift = std::min(rangeIteration, reminder);
33+
int reminded = (rangeIteration < reminder)?1:0;
34+
35+
rangeStart = rangeIteration * chunkSize + shift;
36+
rangeEnd = rangeStart + chunkSize + reminded;
3937
}
4038

4139
rangeEnd = std::min(rangeEnd, itemsCount);

src/software/pipeline/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,19 @@ if (ALICEVISION_BUILD_SFM)
198198
Boost::json
199199
)
200200

201+
# Global Translation Estimating
202+
alicevision_add_software(aliceVision_globalTranslationEstimating
203+
SOURCE main_globalTranslationEstimating.cpp
204+
FOLDER ${FOLDER_SOFTWARE_PIPELINE}
205+
LINKS aliceVision_system
206+
aliceVision_cmdline
207+
aliceVision_sfm
208+
aliceVision_sfmData
209+
aliceVision_track
210+
Boost::program_options
211+
Boost::json
212+
)
213+
201214
# Incremental / Sequential SfM
202215
alicevision_add_software(aliceVision_incrementalSfM
203216
SOURCE main_incrementalSfM.cpp

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

0 commit comments

Comments
 (0)