8 #ifndef META_OCEAN_CV_DETECTOR_ORB_FEATURE_DESCRIPTOR_H
9 #define META_OCEAN_CV_DETECTOR_ORB_FEATURE_DESCRIPTOR_H
21 #if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 30
25 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
56 static inline void determineDescriptors(
const uint32_t* linedIntegralFrame,
const unsigned int width,
const unsigned int height,
ORBFeatures& featurePoints,
const bool useMultiLayers =
false,
Worker* worker =
nullptr);
69 static inline bool detectReferenceFeaturesAndDetermineDescriptors(
const Frame& frame,
ORBFeatures& featurePoints,
const unsigned int pyramidLayers,
const bool useHarrisFeatures,
const unsigned int featureThreshold,
Worker* worker);
90 static inline void determineNonBijectiveCorrespondences(
const ORBFeatures& forwardFeatures,
const ORBFeatures& backwardFeatures,
IndexPairs32& correspondences,
const float threshold = 0.15f,
Worker* worker =
nullptr);
98 static OCEAN_FORCE_INLINE
unsigned int calculateHammingDistance(
const ORBDescriptor& referenceDescriptor,
const ORBDescriptor& featureDescriptor);
113 static void determineDescriptorsSubset(
const uint32_t* linedIntegralFrame,
const unsigned int width,
const unsigned int height,
ORBFeature* featurePoints,
const bool useMultiLayers,
const unsigned int firstFeaturePoint,
const unsigned int numberFeaturePoints);
132 ocean_assert(linedIntegralFrame !=
nullptr);
133 ocean_assert(width >= 43u && height >= 43u);
141 determineDescriptorsSubset(linedIntegralFrame, width, height, featurePoints.data(), useMultiLayers, 0u, (
unsigned int)(featurePoints.size()));
155 if (maxLayerNumber == 0u)
160 const FramePyramid framePyramid(yFrame, std::min(pyramidLayers, maxLayerNumber),
false , worker);
174 ocean_assert(threshold >= 0.0f && threshold <= 1.0f);
176 correspondences.reserve(forwardFeatures.size());
178 if (worker !=
nullptr)
181 worker->
executeFunction(
Worker::Function::createStatic(&
ORBFeatureDescriptor::determineNonBijectiveCorrespondencesSubset, forwardFeatures.data(), forwardFeatures.size(), backwardFeatures.data(), backwardFeatures.size(), threshold, &correspondences, &lock, 0u, 0u), 0u, (
unsigned int)(forwardFeatures.size()));
185 determineNonBijectiveCorrespondencesSubset(forwardFeatures.data(), forwardFeatures.size(), backwardFeatures.data(), backwardFeatures.size(), threshold, &correspondences,
nullptr, 0u, (
unsigned int)(forwardFeatures.size()));
193 return Descriptor::calculateHammingDistance<256>(&referenceDescriptor, &featureDescriptor);
This class implement the descriptor for ORB features.
Definition: ORBDescriptor.h:41
std::bitset< descriptorLengthInBits > DescriptorBitset
Definition of a bitset with 256 bits.
Definition: ORBDescriptor.h:50
This class implements all necessary functions for the ORB feature descriptor and matcher.
Definition: ORBFeatureDescriptor.h:43
static void determineNonBijectiveCorrespondencesSubset(const ORBFeature *forwardFeatures, const size_t numberForwardFeatures, const ORBFeature *backwardFeatures, const size_t numberBackwardFeatures, const float threshold, IndexPairs32 *correspondences, Lock *lock, const unsigned int firstIndex, const unsigned int numberIndices)
Determines feature correspondences for a subset of forward feature points - one backward feature poin...
static void detectReferenceFeaturesAndDetermineDescriptors(const FramePyramid &framePyramid, ORBFeatures &featurePoints, const bool useHarrisFeatures, const unsigned int featureThreshold, Worker *worker)
Detect feature points in a reference frame and calculate the ORB descriptors for them.
static void determineNonBijectiveCorrespondences(const ORBFeatures &forwardFeatures, const ORBFeatures &backwardFeatures, IndexPairs32 &correspondences, const float threshold=0.15f, Worker *worker=nullptr)
Determines feature correspondences - one backward feature point for each given forward feature point.
Definition: ORBFeatureDescriptor.h:172
static void determineDescriptorsSubset(const uint32_t *linedIntegralFrame, const unsigned int width, const unsigned int height, ORBFeature *featurePoints, const bool useMultiLayers, const unsigned int firstFeaturePoint, const unsigned int numberFeaturePoints)
Calculate the ORB descriptor for all given feature points.
static void determineDescriptors(const uint32_t *linedIntegralFrame, const unsigned int width, const unsigned int height, ORBFeatures &featurePoints, const bool useMultiLayers=false, Worker *worker=nullptr)
Calculate the ORB descriptor for all given feature points.
Definition: ORBFeatureDescriptor.h:130
static OCEAN_FORCE_INLINE unsigned int calculateHammingDistance(const ORBDescriptor &referenceDescriptor, const ORBDescriptor &featureDescriptor)
Calculate the hamming distance between two feature descriptors (the number of different bits).
Definition: ORBFeatureDescriptor.h:189
static bool detectReferenceFeaturesAndDetermineDescriptors(const Frame &frame, ORBFeatures &featurePoints, const unsigned int pyramidLayers, const bool useHarrisFeatures, const unsigned int featureThreshold, Worker *worker)
Detect feature points of the reference frame and calculate the ORB descriptors for them.
Definition: ORBFeatureDescriptor.h:145
This class implements a ORB feature.
Definition: ORBFeature.h:40
static bool convert(const Frame &source, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, Frame &target, const bool forceCopy=true, Worker *worker=nullptr, const Options &options=Options())
Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same d...
@ CP_AVOID_COPY_IF_POSSIBLE
Tries to avoid copying the frame data whenever possible.
Definition: FrameConverter.h:96
This class implements a frame pyramid.
Definition: FramePyramid.h:37
static unsigned int idealLayers(const unsigned int width, const unsigned int height, const unsigned int invalidCoarsestWidthOrHeight, unsigned int *coarsestLayerWidth=nullptr, unsigned int *coarsestLayerHeight=nullptr)
Determines the number of layers until an invalid frame size would be reached in the next layer.
bool isValid() const
Returns whether this pyramid holds at least one frame layer.
Definition: FramePyramid.h:863
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
This class implements Ocean's image class.
Definition: Frame.h:1792
@ FORMAT_Y8
Pixel format for grayscale images with byte order Y and 8 bits per pixel.
Definition: Frame.h:594
unsigned int width() const
Returns the width of the frame format in pixel.
Definition: Frame.h:3143
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3148
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
std::vector< IndexPair32 > IndexPairs32
Definition of a vector holding 32 bit index pairs.
Definition: Base.h:144
std::vector< ORBFeature > ORBFeatures
Definition of a vector holding ORB features.
Definition: ORBFeature.h:26
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15