8 #ifndef META_OCEAN_TRACKING_MAPBUILDING_MULTI_VIEW_MAP_CREATOR_H
9 #define META_OCEAN_TRACKING_MAPBUILDING_MULTI_VIEW_MAP_CREATOR_H
71 class OCEAN_TRACKING_MAPBUILDING_EXPORT
Feature
155 inline const Vector3& objectPoint()
const;
162 inline bool isLocalized()
const;
199 inline Scalar stabilityFactor()
const;
205 inline bool isInstable()
const;
210 size_t observationIterations_ = 0;
225 size_t nextLocalizationObservationIterations_ = 3;
231 double timeSinceLastObservation_ = 0.0;
234 static constexpr
size_t maxObservations_ = 100;
240 static constexpr
double maxTimeWithoutObservation_ = 5.0;
269 bool latestFeatureMap(
Vectors3& objectPoints, std::vector<CV::Detector::FREAKDescriptors32>* multiDescriptors =
nullptr,
Scalars* stabilityFactors =
nullptr,
const size_t minimalObservations = 10,
const size_t maximalDescriptorsPerFeaturePoint = 10)
const;
303 static void determineImageFeatures(
const Frames& yFrames,
const SharedAnyCameras& cameras, std::vector<Vectors2>& imagePointGroups, std::vector<CV::Detector::FREAKDescriptors32>& descriptorGroups, std::vector<Indices32>& cornerPyramidLevelGroups, std::vector<Geometry::SpatialDistribution::DistributionArray>& distributionArrays,
Worker* worker);
333 static IndexPairs32 matchStereoFeatures(
const AnyCamera& cameraA,
const AnyCamera& cameraB,
const HomogenousMatrix4& world_T_cameraA,
const HomogenousMatrix4& world_T_cameraB,
const Vectors2& imagePointsA,
const Vectors2& imagePointsB,
const CV::Detector::FREAKDescriptors32& descriptorsA,
const CV::Detector::FREAKDescriptors32 descriptorsB,
const Indices32& pyramidLevelsA,
const Indices32& pyramidLevelsB,
Vectors3& objectPoints);
386 frameIndex_(frameIndex),
387 cameraIndex_(cameraIndex)
393 imagePoint_(imagePoint),
394 observationPair_(observationPair),
395 descriptor_(descriptor)
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements a distribution array.
Definition: SpatialDistribution.h:228
This class implements a recursive lock object.
Definition: Lock.h:31
static constexpr T minValue()
Returns the min scalar value.
Definition: Numeric.h:3250
static constexpr T maxValue()
Returns the max scalar value.
Definition: Numeric.h:3244
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a timestamp.
Definition: Timestamp.h:36
This class implements functions necessary when handling descriptors.
Definition: DescriptorHandling.h:32
This class holds the relevant information for one observation of a 3D feature.
Definition: MultiViewMapCreator.h:92
ObservationPair observationPair_
The observation pair defining to which cameras/images the observation belongs.
Definition: MultiViewMapCreator.h:109
Vector2 imagePoint_
The 2D location of the observation within one camera image.
Definition: MultiViewMapCreator.h:106
Observation(const Vector2 &imagePoint, const ObservationPair &observationPair, const CV::Detector::FREAKDescriptor32 &descriptor)
Creates a new observation object.
Definition: MultiViewMapCreator.h:392
CV::Detector::FREAKDescriptor32 descriptor_
The descriptor of the observation.
Definition: MultiViewMapCreator.h:112
This class holds the relevant information for one 3D feature point.
Definition: MultiViewMapCreator.h:72
Feature(const Vector2 &imagePointA, const Vector2 &imagePointB, const ObservationPair &observationPairA, const ObservationPair &observationPairB, const CV::Detector::FREAKDescriptor32 &descriptorA, const CV::Detector::FREAKDescriptor32 &descriptorB, const HomogenousMatrix4 &world_T_cameraA, const HomogenousMatrix4 &world_T_cameraB, const Vector3 &objectPoint)
Creates a new feature object which has been determined in a stereo view.
static constexpr double maxTimeWithoutObservation_
The maximal time a feature exists without any re-observation, in seconds.
Definition: MultiViewMapCreator.h:240
Scalar stabilityFactor() const
Returns the stability factor of this feature.
Definition: MultiViewMapCreator.h:417
Scalar minimalObservationSqrDistance_
The minimal distance between 3D object point and camera at which the feature has been observed,...
Definition: MultiViewMapCreator.h:219
void addObservation(const Vector2 &imagePoint, const ObservationPair &observationPair, const CV::Detector::FREAKDescriptor32 &descriptor, RandomGenerator &randomGenerator)
Adds a new observation for the feature.
bool isInstable() const
Returns whether this feature is not stable anymore and should be removed.
Definition: MultiViewMapCreator.h:424
std::vector< Observation > Observations
Definition of a vector holding observations.
Definition: MultiViewMapCreator.h:118
double timeSinceLastObservation_
The time since the feature has been observed the last time.
Definition: MultiViewMapCreator.h:231
Feature(const Vector2 &imagePoint, const ObservationPair &observationPair, const CV::Detector::FREAKDescriptor32 &descriptor)
Creates a new feature object which has been determined in a mono view.
const Vector3 & objectPoint() const
Returns the 3D object point of this feature point, if known already.
Definition: MultiViewMapCreator.h:405
const Observations & observations() const
Returns all observations of this feature point.
Definition: MultiViewMapCreator.h:400
Scalar maximalObservationSqrDistance_
The maximal distance between 3D object point and camera at which the feature has bee observed,...
Definition: MultiViewMapCreator.h:222
void copyObservations(const Feature &feature)
Copies the observations from a second feature e.g., to join two features.
bool isLocalized() const
Returns whether this feature point is localized in 3D space.
Definition: MultiViewMapCreator.h:410
LocalizationResult localizeObjectPoint(const std::vector< HomogenousMatrices4 > &world_T_cameraGroups, const std::vector< SharedAnyCameras > &cameraGroups)
(Re-)localizes this feature.
Vector3 objectPoint_
The 3D location of this feature, defined in world.
Definition: MultiViewMapCreator.h:216
LocalizationResult
Definition of individual localization results.
Definition: MultiViewMapCreator.h:79
@ LR_SKIPPED
The localization has been skipped.
Definition: MultiViewMapCreator.h:83
Observations observations_
The observations of this feature.
Definition: MultiViewMapCreator.h:213
bool failedObservation(const Scalar sqrDistance, const double secondsPerFrame)
Informs the feature that is has not been observed.
Definition of a pair combining a frame index with a camera index.
Definition: MultiViewMapCreator.h:47
ObservationPair(const Index32 frameIndex, const Index32 cameraIndex)
Creates a new observation pair.
Definition: MultiViewMapCreator.h:385
This class implements a creator for real-time feature maps based on multiple views (e....
Definition: MultiViewMapCreator.h:40
std::vector< SharedAnyCameras > cameraGroups_
The groups of camera profiles, one group for each multi-frame, one profile for reach frame index.
Definition: MultiViewMapCreator.h:358
static void determineImageFeaturesSubset(const Frame *yFrames, const SharedAnyCamera *cameras, Vectors2 *imagePointGroups, CV::Detector::FREAKDescriptors32 *descriptorGroups, Indices32 *cornerPyramidLevelGroups, Geometry::SpatialDistribution::DistributionArray *distributionArrays, const unsigned int firstGroup, const unsigned int numberGroups)
Determines features in a subset of all frames.
std::vector< Indices32 > currentCornerPyramidLevelGroups_
The groups of pyramid levels in which the image points have been detected in the current multi-frames...
Definition: MultiViewMapCreator.h:367
std::vector< Vectors2 > currentImagePointGroups_
The groups of image points detected in the current multi-frames.
Definition: MultiViewMapCreator.h:361
bool processFrame(const Frames &yFrames, const SharedAnyCameras &cameras, const HomogenousMatrix4 &world_T_device, const HomogenousMatrices4 &device_T_cameras)
Processes multi-frames to extend the current feature map.
Features features_
The features which have been detected so far.
Definition: MultiViewMapCreator.h:373
std::vector< Feature > Features
Definition of a vector holding features.
Definition: MultiViewMapCreator.h:246
std::vector< CV::Detector::FREAKDescriptors32 > currentDescriptorGroups_
The groups of descriptors for the detected image points in the current multi-frames.
Definition: MultiViewMapCreator.h:364
bool latestFeatureMap(Vectors3 &objectPoints, std::vector< CV::Detector::FREAKDescriptors32 > *multiDescriptors=nullptr, Scalars *stabilityFactors=nullptr, const size_t minimalObservations=10, const size_t maximalDescriptorsPerFeaturePoint=10) const
Extracts the latest feature map from this creator.
static bool determineLowerStereoCameras(const HomogenousMatrices4 &device_T_cameras, IndexPair32 &stereoCameraIndices)
Determines the indices of the two lower (hopefully overlapping) stereo cameras.
static IndexPairs32 matchMonoFeatures(const AnyCamera &cameraA, const AnyCamera &cameraB, const HomogenousMatrix4 &world_T_cameraA, const HomogenousMatrix4 &world_T_cameraB, const Vectors2 &imagePointsA, const Vectors2 &imagePointsB, const CV::Detector::FREAKDescriptors32 &descriptorsA, const CV::Detector::FREAKDescriptors32 descriptorsB, const Indices32 &pyramidLevelsA, const Indices32 &pyramidLevelsB)
Determines feature matches between two mono images (using the same camera at different moments in tim...
static IndexPairs32 matchStereoFeatures(const AnyCamera &cameraA, const AnyCamera &cameraB, const HomogenousMatrix4 &world_T_cameraA, const HomogenousMatrix4 &world_T_cameraB, const Vectors2 &imagePointsA, const Vectors2 &imagePointsB, const CV::Detector::FREAKDescriptors32 &descriptorsA, const CV::Detector::FREAKDescriptors32 descriptorsB, const Indices32 &pyramidLevelsA, const Indices32 &pyramidLevelsB, Vectors3 &objectPoints)
Determines feature matches between two stereo images.
static void determineImageFeatures(const Frames &yFrames, const SharedAnyCameras &cameras, std::vector< Vectors2 > &imagePointGroups, std::vector< CV::Detector::FREAKDescriptors32 > &descriptorGroups, std::vector< Indices32 > &cornerPyramidLevelGroups, std::vector< Geometry::SpatialDistribution::DistributionArray > &distributionArrays, Worker *worker)
Determines features in all frames.
RandomGenerator randomGenerator_
The creator's random generator object.
Definition: MultiViewMapCreator.h:376
void determineObservations(const Index32 currentFrameIndex, const Timestamp ¤tTimestamp, const HomogenousMatrix4 &world_T_device, const HomogenousMatrices4 &world_T_currentCameras, const SharedAnyCameras ¤tCameras, std::vector< Geometry::SpatialDistribution::DistributionArray > &distributionArrays)
Determines observations for existing localized 3D feature points.
std::vector< HomogenousMatrices4 > world_T_cameraGroups_
The groups of transformations between cameras and world, one group for each multi-frame,...
Definition: MultiViewMapCreator.h:355
Lock lock_
The creator's lock.
Definition: MultiViewMapCreator.h:379
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
unsigned int sqrDistance(const char first, const char second)
Returns the square distance between two values.
Definition: base/Utilities.h:1089
std::vector< IndexPair32 > IndexPairs32
Definition of a vector holding 32 bit index pairs.
Definition: Base.h:144
std::vector< Frame > Frames
Definition of a vector holding padding frames.
Definition: Frame.h:1755
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition: Base.h:96
std::pair< Index32, Index32 > IndexPair32
Definition of a pair holding 32 bit indices.
Definition: Base.h:138
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition: HomogenousMatrix4.h:73
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition: AnyCamera.h:60
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition: Math.h:144
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition: Vector3.h:22
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition: Vector2.h:64
SharedAnyCamerasT< Scalar > SharedAnyCameras
Definition of a vector holding AnyCamera objects.
Definition: AnyCamera.h:90
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
std::vector< FREAKDescriptor32 > FREAKDescriptors32
Vector of 32-bytes long FREAK descriptors.
Definition: FREAKDescriptor.h:69
FREAKDescriptorT< 32 > FREAKDescriptor32
Typedef for the 32-bytes long FREAK descriptor.
Definition: FREAKDescriptor.h:66
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15