8#ifndef META_OCEAN_TRACKING_SLAM_FRAME_PYRAMID_MANAGER_H
9#define META_OCEAN_TRACKING_SLAM_FRAME_PYRAMID_MANAGER_H
66 inline Index32 frameIndex()
const;
78 inline const Frame& finestLayer()
const;
90 inline Frame& finestLayer();
101 inline bool isValid()
const;
107 inline operator bool()
const;
188 unsigned int usageCounter_ = 0u;
244 inline size_t size()
const;
255 static unsigned int idealPyramidLayers(
const unsigned int width,
const unsigned int height,
const unsigned int patchSize,
const float maximalTrackingDistance,
const unsigned int coarseLayerRadius);
281 *
this = std::move(scopedPyramid);
296 ocean_assert(pyramid_);
302 ocean_assert(pyramid_);
303 return pyramid_->finestLayer();
308 ocean_assert(pyramid_);
314 return pyramid_->finestLayer();
319 return pyramid_ !=
nullptr;
322inline FramePyramidManager::ScopedPyramid::operator bool()
const
329 ocean_assert(pyramid_);
335 ocean_assert(pyramid_);
341 ocean_assert(pyramid_);
347 ocean_assert(pyramid_);
354 frameIndex_(frameIndex)
This class implements a frame pyramid.
Definition FramePyramid.h:46
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
size_t size() const
Returns the size of this vector.
Definition StaticVector.h:390
This class implements a pyramid object with usage counter.
Definition FramePyramidManager.h:181
CV::FramePyramid framePyramid_
The actual frame pyramid.
Definition FramePyramidManager.h:191
This class implements a scoped pyramid object providing automatic lifetime management.
Definition FramePyramidManager.h:41
ScopedPyramid(const ScopedPyramid &scopedPyramid)=delete
Disabled copy constructor.
const CV::FramePyramid & pyramid() const
Returns a const reference to the pyramid.
Definition FramePyramidManager.h:294
void release()
Explicitly releases the pyramid before the scoped object is destroyed.
const Frame & finestLayer() const
Returns the finest layer of the pyramid.
Definition FramePyramidManager.h:300
bool isValid() const
Returns whether this scoped pyramid is valid.
Definition FramePyramidManager.h:317
ScopedPyramid()=default
Creates an invalid scoped pyramid object.
const CV::FramePyramid & operator*() const
Returns a const reference to the pyramid.
Definition FramePyramidManager.h:327
~ScopedPyramid()
Destructs the scoped pyramid and releases the pyramid.
Definition FramePyramidManager.h:284
const CV::FramePyramid * operator->() const
Returns a const pointer to the pyramid.
Definition FramePyramidManager.h:339
ScopedPyramid & operator=(const ScopedPyramid &scopedPyramid)=delete
Disabled copy assignment operator.
Index32 frameIndex() const
Returns the frame index of this pyramid.
Definition FramePyramidManager.h:289
ScopedPyramid & operator=(ScopedPyramid &&scopedPyramid) noexcept
Move assignment operator.
This class manages a pool of frame pyramids for efficient reuse.
Definition FramePyramidManager.h:33
Objects freeObjects_
The vector of free pyramid objects.
Definition FramePyramidManager.h:266
Lock lock_
The lock object.
Definition FramePyramidManager.h:269
FramePyramidManager()=default
Creates a new manager object.
std::shared_ptr< Object > SharedObject
Definition of a shared pointer to an object.
Definition FramePyramidManager.h:195
size_t size() const
Returns the number of currently used pyramids.
Definition FramePyramidManager.h:272
Objects usedObjects_
The vector of used pyramid objects.
Definition FramePyramidManager.h:263
static unsigned int idealPyramidLayers(const unsigned int width, const unsigned int height, const unsigned int patchSize, const float maximalTrackingDistance, const unsigned int coarseLayerRadius)
Determines the ideal number of pyramid layers for given parameters.
ScopedPyramid newPyramid(const Index32 frameIndex)
Creates a new pyramid for a given frame index.
ScopedPyramid existingPyramid(const Index32 frameIndex)
Returns an existing pyramid for a given frame index.
void unlockPyramid(const Index32 frameIndex)
Unlocks a pyramid for a given frame index.
ScopedPyramid latestPyramid()
Returns the latest pyramid.
void updateLatest(const Index32 frameIndex)
Updates the latest pyramid to a given frame index.
uint32_t Index32
Definition of a 32 bit index value.
Definition Base.h:84
The namespace covering the entire Ocean framework.
Definition Accessor.h:15
AutomaticDifferentiationT< T1, TNumeric1 > operator*(const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right)
Definition AutomaticDifferentiation.h:523