10 #include <aliceVision/numeric/numeric.hpp>
11 #include <aliceVision/feature/imageDescriberCommon.hpp>
12 #include <aliceVision/feature/Regions.hpp>
13 #include <aliceVision/image/Image.hpp>
25 enum class EImageDescriberPreset
34 inline std::string EImageDescriberPreset_information()
36 return "Feature preset controls the density of the feature extraction:\n"
37 "* LOW: Very low density (max 1K points).\n"
38 "* MEDIUM: Low density (max 5K points).\n"
39 "* NORMAL: Default feature density (max 10K points).\n"
40 "* HIGH: High density (max 50K points).\n"
41 "* ULTRA: Very high density (max 100K points). Can use large amount of storage and large amount of computation. Use only on small "
45 EImageDescriberPreset EImageDescriberPreset_stringToEnum(
const std::string& imageDescriberPreset);
46 std::string EImageDescriberPreset_enumToString(
const EImageDescriberPreset imageDescriberPreset);
47 std::ostream& operator<<(std::ostream& os, EImageDescriberPreset p);
48 std::istream& operator>>(std::istream& in, EImageDescriberPreset& p);
53 enum class EFeatureQuality
62 inline std::string EFeatureQuality_information()
64 return "Feature extraction contains a trade-off between speed and result accuracy:\n"
65 "* LOW: Very quick results.\n"
66 "* MEDIUM: Quick results.\n"
67 "* NORMAL: Default feature quality.\n"
68 "* HIGH: Improved quality over performances.\n"
69 "* ULTRA: Highest quality at the expense of high computational cost.\n";
72 EFeatureQuality EFeatureQuality_stringToEnum(
const std::string& v);
73 std::string EFeatureQuality_enumToString(
const EFeatureQuality v);
74 std::ostream& operator<<(std::ostream& os, EFeatureQuality v);
75 std::istream& operator>>(std::istream& in, EFeatureQuality& v);
80 enum class EFeatureConstrastFiltering
85 AdaptiveToMedianVariance,
100 inline std::string EFeatureConstrastFiltering_information()
102 return "Contrast filtering method to ignore features with too low contrast that can be consided as noise:\n"
103 "* Static: Fixed threshold.\n"
104 "* AdaptiveToMedianVariance: Based on image content analysis.\n"
105 "* NoFiltering: Disable contrast filtering.\n"
106 "* GridSortOctaves: Grid sort by peak value per octave and by scale at the end.\n"
107 "* GridSort: Grid sort by scale*peakValue per octave and at the end.\n"
108 "* GridSortScaleSteps: Grid sort per scale steps and at the end (scale and then peak value).\n"
109 "* GridSortOctaveSteps: Grid sort per octaves and at the end (scale and then peak value).\n"
110 "* NonExtremaFiltering: Filter non-extrema peak values.\n";
113 EFeatureConstrastFiltering EFeatureConstrastFiltering_stringToEnum(
const std::string& v);
114 std::string EFeatureConstrastFiltering_enumToString(
const EFeatureConstrastFiltering v);
115 std::ostream& operator<<(std::ostream& os, EFeatureConstrastFiltering v);
116 std::istream& operator>>(std::istream& in, EFeatureConstrastFiltering& v);
120 EImageDescriberPreset descPreset{EImageDescriberPreset::NORMAL};
121 int maxNbFeatures{0};
122 EFeatureQuality quality{EFeatureQuality::NORMAL};
123 bool gridFiltering{
true};
124 EFeatureConstrastFiltering contrastFiltering{EFeatureConstrastFiltering::Static};
125 float relativePeakThreshold{0.02f};
134 descPreset = EImageDescriberPreset_stringToEnum(v);
146 contrastFiltering = v;
151 contrastFiltering = EFeatureConstrastFiltering_stringToEnum(v);
170 virtual bool useCuda()
const = 0;
225 [[maybe_unused]] std::unique_ptr<Regions>& regions,
228 throw std::logic_error(
"Cannot use " + EImageDescriberType_enumToString(
getDescriberType()) +
" image describer with an 8-bit image.");
240 [[maybe_unused]] std::unique_ptr<Regions>& regions,
243 throw std::logic_error(
"Cannot use " + EImageDescriberType_enumToString(
getDescriberType()) +
" image describer with a float image.");
251 virtual void allocate(std::unique_ptr<Regions>& regions)
const = 0;
255 void Load(
Regions* regions,
const std::string& sfileNameFeats,
const std::string& sfileNameDescs)
const
257 regions->Load(sfileNameFeats, sfileNameDescs);
260 void Save(
const Regions* regions,
const std::string& sfileNameFeats,
const std::string& sfileNameDescs)
const;
262 void LoadFeatures(
Regions* regions,
const std::string& sfileNameFeats)
const { regions->LoadFeatures(sfileNameFeats); }
269 std::unique_ptr<ImageDescriber> createImageDescriber(EImageDescriberType imageDescriberType);