Ocean
|
This class implements a frame pyramid. More...
Public Types | |
enum | DownsamplingMode : uint32_t { DM_FILTER_11 , DM_FILTER_14641 } |
Definition of individual down sampling modes. More... | |
using | DownsamplingFunction = std::function< bool(const Frame &sourceLayer, Frame &targetLayer, Worker *worker)> |
Definition of a function allowing to downsample a frame. More... | |
Public Member Functions | |
FramePyramid () | |
Creates an empty frame pyramid object. More... | |
FramePyramid (const FramePyramid &framePyramid, const bool copyData) | |
Copy constructor. More... | |
FramePyramid (FramePyramid &&framePyramid) noexcept | |
Move constructor. More... | |
FramePyramid (const unsigned int layers, const FrameType &frameType) | |
Creates a frame pyramid object for a given frame type and layer number. More... | |
FramePyramid (const uint8_t *frame, const unsigned int width, const unsigned int height, const unsigned int channels, const FrameType::PixelOrigin pixelOrigin, const unsigned int layers, const unsigned int framePaddingElements, const bool copyFirstLayer, Worker *worker=nullptr, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED, const Timestamp timestamp=Timestamp(false)) | |
Creates a new pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling. More... | |
FramePyramid (const Frame &frame, const unsigned int layers, const bool copyFirstLayer, Worker *worker=nullptr) | |
Creates a new pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling. More... | |
FramePyramid (const uint8_t *frame, const unsigned int width, const unsigned int height, const unsigned int channels, const FrameType::PixelOrigin pixelOrigin, const DownsamplingMode downsamplingMode, const unsigned int layers, const unsigned int framePaddingElements, const bool copyFirstLayer, Worker *worker, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED, const Timestamp timestamp=Timestamp(false)) | |
Creates a frame pyramid based on a frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a custom downsampling. More... | |
FramePyramid (const Frame &frame, const DownsamplingMode downsamplingMode, const unsigned int layers, const bool copyFirstLayer, Worker *worker) | |
Creates a frame pyramid based on a frame applying a custom downsampling. More... | |
FramePyramid (const Frame &frame, const DownsamplingFunction &downsamplingFunction, const unsigned int layers, const bool copyFirstLayer, Worker *worker) | |
Creates a frame pyramid based on a frame applying a custom downsampling. More... | |
FramePyramid (const DownsamplingMode downsamplingMode, Frame &&frame, const unsigned int layers, Worker *worker) | |
Creates a frame pyramid based on a frame applying a custom downsampling. More... | |
FramePyramid (const DownsamplingFunction &downsamplingFunction, Frame &&frame, const unsigned int layers, Worker *worker) | |
Creates a frame pyramid based on a frame applying a custom downsampling. More... | |
FramePyramid (const FramePyramid &framePyramid, const unsigned int firstLayerIndex, const unsigned int layers, bool copyData) | |
Creates a new frame pyramid based on an existing frame pyramid. More... | |
const Frame & | layer (const unsigned int layer) const |
Returns the frame of a specified layer. More... | |
Frame & | layer (const unsigned int layer) |
Returns the frame of a specified layer. More... | |
const Frame & | finestLayer () const |
Returns the finest layer frame of this pyramid. More... | |
Frame & | finestLayer () |
Returns the coarsest layer frame of this pyramid. More... | |
const Frame & | coarsestLayer () const |
Returns the coarsest layer frame of this pyramid regarding to the number of valid layers. More... | |
Frame & | coarsestLayer () |
Returns the finest layer frame of this pyramid regarding to the number of valid layers. More... | |
unsigned int | layers () const |
Returns the number of layers this pyramid holds. More... | |
unsigned int | width (const unsigned int layer) const |
Returns the width of a given layer. More... | |
unsigned int | height (const unsigned int layer) const |
Returns the height of a given layer. More... | |
unsigned int | finestWidth () const |
Returns the width of the finest (first) layer. More... | |
unsigned int | finestHeight () const |
Returns the height of the finest (first) layer. More... | |
unsigned int | coarsestWidth () const |
Returns the width of the coarsest (last) layer regarding to the number of valid layers. More... | |
unsigned int | coarsestHeight () const |
Returns the height of the coarsest (last) layer regarding to the number of valid layers. More... | |
unsigned int | coarsestSizeFactor () const |
Returns the size factor for the coarsest layer in relation to the finest layer regarding to the number of valid layers. More... | |
const FrameType & | frameType () const |
Returns the frame type of the finest layer. More... | |
bool | replace (const Frame &frame, const DownsamplingMode downsamplingMode, const unsigned int layers, const bool copyFirstLayer, Worker *worker) |
Replaces this frame pyramid based on a new frame. More... | |
bool | replace (const Frame &frame, const DownsamplingFunction &downsamplingFunction, const unsigned int layers, const bool copyFirstLayer, Worker *worker) |
Replaces this frame pyramid based on a new frame. More... | |
bool | replace (const DownsamplingMode downsamplingMode, Frame &&frame, const unsigned int layers, Worker *worker) |
Replaces this frame pyramid based on a new frame. More... | |
bool | replace (const DownsamplingFunction &downsamplingFunction, Frame &&frame, const unsigned int layers, Worker *worker) |
Replaces this frame pyramid based on a new frame. More... | |
bool | replace8BitPerChannel (const uint8_t *frame, const unsigned int width, const unsigned int height, const unsigned int channels, const FrameType::PixelOrigin pixelOrigin, const DownsamplingMode downsamplingMode, const unsigned int layers, const unsigned int framePaddingElements, const bool copyFirstLayer, Worker *worker, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED, const Timestamp timestamp=Timestamp(false)) |
Replaces this frame pyramid based on a new frame. More... | |
bool | replace8BitPerChannel11 (const uint8_t *frame, const unsigned int width, const unsigned int height, const unsigned int channels, const FrameType::PixelOrigin pixelOrigin, const unsigned int layers, const unsigned int framePaddingElements, const bool copyFirstLayer, Worker *worker, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED, const Timestamp timestamp=Timestamp(false)) |
Replaces this frame pyramid by a new frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling. More... | |
bool | replace8BitPerChannel11 (const Frame &frame, const unsigned int layers, const bool copyFirstLayer, Worker *worker) |
Replaces this frame pyramid by a new frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling. More... | |
bool | replace (const FrameType &frameType, const bool forceOwner, const unsigned int layers) |
Replaces this frame pyramid with a new pyramid defined by the frame type of the finest layer. More... | |
void | reduceLayers (const size_t layers) |
Reduces the number of pyramid layers. More... | |
void | clear () |
Releases the internal frame layers. More... | |
bool | isOwner (const unsigned int layerIndex=AS_MANY_LAYERS_AS_POSSIBLE) const |
Returns whether the frame pyramid is the owner of the entire image data or owner of a specific pyramid layer. More... | |
bool | isValid () const |
Returns whether this pyramid holds at least one frame layer. More... | |
const Memory & | memory () const |
Returns the pyramid's memory block. More... | |
FramePyramid & | operator= (FramePyramid &&right) noexcept |
Move operator. More... | |
const Frame & | operator[] (const unsigned int layer) const |
Returns the frame of a specified layer. More... | |
Frame & | operator[] (const unsigned int layer) |
Returns the frame of a specified layer. More... | |
operator bool () const | |
Returns whether this pyramid holds at least one frame layer. More... | |
Static Public Member Functions | |
static constexpr unsigned int | sizeFactor (const unsigned int layer) |
Returns the size factor of a specified layer in relation to the finest layer. More... | |
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. More... | |
static unsigned int | idealLayers (const unsigned int width, const unsigned int height, const unsigned int invalidCoarsestWidth, const unsigned int invalidCoarsestHeight, 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. More... | |
static unsigned int | idealLayers (const unsigned int width, const unsigned int height, const unsigned int invalidCoarsestWidth, const unsigned int invalidCoarsestHeight, const unsigned int layerFactor, const unsigned int maximalRadius=(unsigned int)(-1), const unsigned int coarsestLayerRadius=2u, 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 or an overall size radius is reached. More... | |
Static Public Attributes | |
static constexpr unsigned int | AS_MANY_LAYERS_AS_POSSIBLE = (unsigned int)(-1) |
Definition of a value that can be used to create as many pyramid layers as possible (so that the coarsest pyramid layer has resolution 1x1). More... | |
Protected Member Functions | |
FramePyramid (Frame &&)=delete | |
Disabled constructor. More... | |
FramePyramid (const Frame &, const bool)=delete | |
Disabled constructor. More... | |
FramePyramid (const Frame &frame, const DownsamplingMode downsamplingMode, const unsigned int layers, Worker *worker)=delete | |
Disabled constructor to prevent confusion between all constructors. More... | |
FramePyramid (const Frame &frame, const DownsamplingFunction &downsamplingFunction, const unsigned int layers, Worker *worker)=delete | |
Disabled constructor to prevent confusion between all constructors. More... | |
bool | replace (const FrameType &frameType, const bool reserveFirstLayerMemory, const bool forceOwner, const unsigned int layers) |
Replaces this frame pyramid with a new pyramid defined by the frame type of the finest layer. More... | |
bool | replace (const Frame &frame, const bool forceOwner, const unsigned int layers=AS_MANY_LAYERS_AS_POSSIBLE)=delete |
Deleted function to prevent confusion between Frame and FrameType. More... | |
FramePyramid & | operator= (const FramePyramid &)=delete |
Disabled assign operator Use a constructor or the move operator instead. More... | |
bool | replace (const Frame &, const DownsamplingMode, const unsigned int layers, Worker *worker)=delete |
Deleted function to prevent confusion between several different replace functions. More... | |
bool | replace (const Frame &, const DownsamplingFunction &, const unsigned int layers, Worker *worker)=delete |
Deleted function to prevent confusion between several different replace functions. More... | |
Static Protected Member Functions | |
static size_t | calculateMemorySize (const unsigned int width, const unsigned int height, const FrameType::PixelFormat pixelFormat, const unsigned int layers, const bool includeFirstLayer, unsigned int *totalLayers=nullptr) |
Calculates the size of the entire pyramid in bytes covering all images in all pyramid layers. More... | |
static bool | downsampleByTwo11 (const Frame &finerLayer, Frame &coarserLayer, Worker *worker) |
Downsamples a frame with 1-1 filter. More... | |
static bool | downsampleAlphaByTwo11 (const Frame &finerLayer, Frame &coarserLayer, Worker *worker) |
Downsamples a frame with 1-1 filter which contains an alpha channel. More... | |
static bool | downsampleByTwo14641 (const Frame &finerLayer, Frame &coarserLayer, Worker *worker) |
Downsamples a frame with 1-4-6-4-1 filter. More... | |
static CV::FramePyramid::DownsamplingFunction | downsamplingFunction (const CV::FramePyramid::DownsamplingMode downsamplingMode, const FrameType::PixelFormat pixelFormat) |
Returns the downsampling function for a specified downsampling mode. More... | |
Protected Attributes | |
Frames | layers_ |
The individual layers of this pyramid, zero if not valid. More... | |
Memory | memory_ |
Optional memory which may be used by at least one pyramid layer. More... | |
Static Protected Attributes | |
static constexpr size_t | memoryAlignmentBytes_ = 8 |
The number of bytes for memory alignment. More... | |
This class implements a frame pyramid.
A frame pyramid holds the same frame with several scale spaces.
Each further layer holds the frame with half size (half width and half height).
The finest layer has index 0 and the coarsest layer has the highest index.
using Ocean::CV::FramePyramid::DownsamplingFunction = std::function<bool(const Frame& sourceLayer, Frame& targetLayer, Worker* worker)> |
Definition of a function allowing to downsample a frame.
sourceLayer | The source layer to downsample |
targetLayer | The target layer reviving the downsampled image content |
worker | Optional worker to distribute the computation |
enum Ocean::CV::FramePyramid::DownsamplingMode : uint32_t |
Definition of individual down sampling modes.
|
inline |
Creates an empty frame pyramid object.
Ocean::CV::FramePyramid::FramePyramid | ( | const FramePyramid & | framePyramid, |
const bool | copyData | ||
) |
Copy constructor.
framePyramid | Frame pyramid to be copied |
copyData | True, to copy the image content of the frame pyramid; False, to only reuse the image content of the frame pyramid |
|
noexcept |
Move constructor.
framePyramid | Frame pyramid to be moved |
|
explicit |
Creates a frame pyramid object for a given frame type and layer number.
The resulting pyramid may have fewer layers than desired.
The image content of the replaced frame pyramid will be uninitialized.
layers | The preferred number of layers to be created, with range [1, infinity), AS_MANY_LAYERS_AS_POSSIBLE to create as may layers as possible |
frameType | Type of the frame to create a frame pyramid for, must be valid |
|
inline |
Creates a new pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling.
This constructor is intentionally restrictive to reduce binary impact when used, use other constructors or functions in case more flexibility is needed an binary size does not matter.
The constructor mainly calls replace8BitPerChannel11().
frame | The frame for which the pyramid will be created, must be valid |
width | The width of the given frame in pixel, with range [1, infinity) |
height | The height of the given frame in pixel, with range [1, infinity) |
channels | The number of channels the given frame has, with range [1, infinity) |
pixelOrigin | The pixel origin of the given frame |
layers | Number of pyramid layers to be created, with range [1, infinity) |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
pixelFormat | The explicit pixel format which will be used for each pyramid layer, must be compatible with DT_UNSIGNED_INTEGER_8 and 'channels'; FORMAT_UNDEFINED to use a generic pixel format |
timestamp | Timestamp to be assigned to the frame pyramid (e.g., the timestamp of the frame used to created the timestamp) |
|
inline |
Creates a new pyramid frame for frames with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling.
This constructor is intentionally restrictive to reduce binary impact when used, use other constructors or functions in case more flexibility is needed an binary size does not matter.
In case the provided frame not a valid 1-plane DT_UNSIGNED_INTEGER_8 frame, the pyramid will be invalid.
The constructor mainly calls replace8BitPerChannel11().
frame | The frame for which the pyramid will be created, with 1 plane and data type DT_UNSIGNED_INTEGER_8, must be valid |
layers | Number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
|
inline |
Creates a frame pyramid based on a frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a custom downsampling.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer) or will just use the memory, depending on 'copyFirstLayer'.
The constructor mainly calls replace8BitPerChannel().
frame | The frame for which the pyramid will be created, must be valid |
width | The width of the frame in pixel, with range [1, infinity) |
height | The height of the frame in pixel, with range [1, infinity) |
channels | The number of channels the given frame has, with range [1, infinity) |
pixelOrigin | The pixel origin of the given frame |
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
layers | Number of pyramid layers to be created, with range [1, infinity) |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
pixelFormat | The explicit pixel format which will be used for each pyramid layer, must be compatible with DT_UNSIGNED_INTEGER_8 and 'channels'; FORMAT_UNDEFINED to use a generic pixel format |
timestamp | Timestamp to be assigned to the frame pyramid (e.g., the timestamp of the frame used to created the timestamp) |
|
inline |
Creates a frame pyramid based on a frame applying a custom downsampling.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer) or will just use the memory, depending on 'copyFirstLayer'.
frame | The frame for which the pyramid will be created, must be valid |
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, |
worker | Optional worker object to distribute the computation |
|
inline |
Creates a frame pyramid based on a frame applying a custom downsampling.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer) or will just use the memory, depending on 'copyFirstLayer'.
frame | The frame for which the pyramid will be created, must be valid |
downsamplingFunction | The custom function used to downsample the individual pyramid layers, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, |
worker | Optional worker object to distribute the computation |
|
inline |
Creates a frame pyramid based on a frame applying a custom downsampling.
The resulting pyramid will re-used the given frame (as finest pyramid layer); thus, ensure that the frame's memory is valid as long as this pyramid exists.
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
frame | The frame for which the pyramid will be created, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
worker | Optional worker object to distribute the computation |
|
inline |
Creates a frame pyramid based on a frame applying a custom downsampling.
The resulting pyramid will re-used the given frame (as finest pyramid layer); thus, ensure that the frame's memory is valid as long as this pyramid exists.
downsamplingFunction | The custom function used to downsample the individual pyramid layers, must be valid |
frame | The frame for which the pyramid will be created, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
worker | Optional worker object to distribute the computation |
Ocean::CV::FramePyramid::FramePyramid | ( | const FramePyramid & | framePyramid, |
const unsigned int | firstLayerIndex, | ||
const unsigned int | layers, | ||
bool | copyData | ||
) |
Creates a new frame pyramid based on an existing frame pyramid.
framePyramid | The existing frame pyramid from which the new pyramid will be created, must be valid |
firstLayerIndex | The index of the first layer to use from the source pyramid, with range [0, framePyramid.layers() - 1] |
layers | The number of layers to use from the source pyramid, with range [1, infinity), AS_MANY_LAYERS_AS_POSSIBLE to use as many layers as exist |
copyData | True, to make a copy of the image content of the existing pyramid; False, to only use the memory |
|
explicitprotecteddelete |
Disabled constructor.
|
protecteddelete |
Disabled constructor.
|
protecteddelete |
Disabled constructor to prevent confusion between all constructors.
|
protecteddelete |
Disabled constructor to prevent confusion between all constructors.
|
staticprotected |
Calculates the size of the entire pyramid in bytes covering all images in all pyramid layers.
width | The width of the finest layer in pixel, with range [0, 65535] |
height | The height of the finest layer in pixel, with range [0, 65535] |
pixelFormat | The pixel format of each layer, must be a generic 1-plane pixel format, must be valid |
layers | Number of layers, with range [0, infinity) |
includeFirstLayer | True, to determine the memory for all layers; False, to skip the first layer and only determine the memory for all remaining (coarser) layers |
totalLayers | Optional resulting number of pyramid layers that will exist (always counts the very first layer independently of 'includeFirstLayer'), with range [0, layers] |
|
inline |
Releases the internal frame layers.
|
inline |
Returns the height of the coarsest (last) layer regarding to the number of valid layers.
If no valid layer is stored in this pyramid, the finest layer is used instead.
|
inline |
Returns the finest layer frame of this pyramid regarding to the number of valid layers.
If no valid layer is stored in this pyramid, the finest layer is used instead.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
|
inline |
Returns the coarsest layer frame of this pyramid regarding to the number of valid layers.
If no valid layer is stored in this pyramid, the finest layer is used instead.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
|
inline |
Returns the size factor for the coarsest layer in relation to the finest layer regarding to the number of valid layers.
If no valid layer is stored in this pyramid, the finest layer is used instead.
|
inline |
Returns the width of the coarsest (last) layer regarding to the number of valid layers.
If no valid layer is stored in this pyramid, the finest layer is used instead.
|
staticprotected |
Downsamples a frame with 1-1 filter which contains an alpha channel.
finerLayer | The finer pyramid layer, must be valid |
coarserLayer | The coarser pyramid layer, must be valid |
worker | The optional worker to distribute the computation |
|
staticprotected |
Downsamples a frame with 1-1 filter.
finerLayer | The finer pyramid layer, must be valid |
coarserLayer | The coarser pyramid layer, must be valid |
worker | The optional worker to distribute the computation |
|
staticprotected |
Downsamples a frame with 1-4-6-4-1 filter.
finerLayer | The finer pyramid layer, must be valid |
coarserLayer | The coarser pyramid layer, must be valid |
worker | The optional worker to distribute the computation |
|
staticprotected |
Returns the downsampling function for a specified downsampling mode.
downsamplingMode | The downsampling mode for which the function will be returned |
pixelFormat | The pixel format for which the downsampling function will be returned, must be valid |
|
inline |
Returns the height of the finest (first) layer.
|
inline |
Returns the coarsest layer frame of this pyramid.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
|
inline |
Returns the finest layer frame of this pyramid.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
|
inline |
Returns the width of the finest (first) layer.
|
inline |
Returns the frame type of the finest layer.
Beware: Ensure that the pyramid holds at least one pyramid layer before calling this function.
|
inline |
Returns the height of a given layer.
layer | The layer to return the height for, with range [0, layers()) |
|
static |
Determines the number of layers until an invalid frame size would be reached in the next layer or an overall size radius is reached.
width | The width of the finest layer in pixel |
height | The height of the finest layer in pixel |
invalidCoarsestWidth | Width of a coarse layer not valid any more, with range (0, infinity) |
invalidCoarsestHeight | Height of a coarse layer not valid any more, with range (0, infinity) |
layerFactor | Size factor on each layer (a factor of 2 means that the layer dimension is halved on each layer), with range [2, infinity) |
maximalRadius | Maximal radius that can be reached on the finest layer by starting with coarsestLayerRadius on the coarsest layer in pixel (the maximal expected baseline between two pixels in the finest pyramid layer), with range [1, infinity) |
coarsestLayerRadius | The search radius on the coarsest layer, with range [2, infinity) |
coarsestLayerWidth | Optional resulting width of the coarsest valid pyramid layer, with range [invalidCoarsestWidth + 1u, width], nullptr if not of interest |
coarsestLayerHeight | Optional resulting height of the coarsest valid pyramid layer, with range [invalidCoarsestHeight + 1u, height], nullptr if not of interest |
|
static |
Determines the number of layers until an invalid frame size would be reached in the next layer.
width | The width of the finest layer in pixel, with range [1, infinity) |
height | The height of the finest layer in pixel, with range [1, infinity) |
invalidCoarsestWidth | The width of a coarse layer not valid any more, with range (0, infinity) |
invalidCoarsestHeight | The height of a coarse layer not valid any more, with range (0, infinity) |
coarsestLayerWidth | Optional resulting width of the coarsest valid pyramid layer, with range [invalidCoarsestWidth + 1u, width], nullptr if not of interest |
coarsestLayerHeight | Optional resulting height of the coarsest valid pyramid layer, with range [invalidCoarsestHeight + 1u, height], nullptr if not of interest |
|
static |
Determines the number of layers until an invalid frame size would be reached in the next layer.
width | The width of the finest layer in pixel, with range [1, infinity) |
height | The height of the finest layer in pixel, with range [1, infinity) |
invalidCoarsestWidthOrHeight | The width or the height of a coarse layer not valid any more, with range (0, infinity) |
coarsestLayerWidth | Optional resulting width of the coarsest valid pyramid layer, with range [invalidCoarsestWidth + 1u, width], nullptr if not of interest |
coarsestLayerHeight | Optional resulting height of the coarsest valid pyramid layer, with range [invalidCoarsestHeight + 1u, height], nullptr if not of interest |
bool Ocean::CV::FramePyramid::isOwner | ( | const unsigned int | layerIndex = AS_MANY_LAYERS_AS_POSSIBLE | ) | const |
Returns whether the frame pyramid is the owner of the entire image data or owner of a specific pyramid layer.
layerIndex | The index of the layer to be checked, 'AS_MANY_LAYERS_AS_POSSIBLE" to check all layers |
|
inline |
Returns whether this pyramid holds at least one frame layer.
|
inline |
Returns the frame of a specified layer.
layer | Index of the layer frame to be returned, with range [0, layers()) |
|
inline |
Returns the frame of a specified layer.
layer | Index of the layer frame to be returned, with range [0, layers()) |
|
inline |
Returns the number of layers this pyramid holds.
|
inline |
Returns the pyramid's memory block.
This functions is intended for testing purposes only, don't use this function.
|
inlineexplicit |
Returns whether this pyramid holds at least one frame layer.
|
protecteddelete |
Disabled assign operator Use a constructor or the move operator instead.
|
noexcept |
Move operator.
right | The right frame to assign |
|
inline |
Returns the frame of a specified layer.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
layer | Index of the layer frame to be returned, with range [0, layers()) |
|
inline |
Returns the frame of a specified layer.
Beware: The frame will not be the owner of the frame data, if you need a copy of this frame enforce to copy the frame buffer!
layer | Index of the layer frame to be returned, with range [0, layers()) |
void Ocean::CV::FramePyramid::reduceLayers | ( | const size_t | layers | ) |
Reduces the number of pyramid layers.
layers | The number of pyramid layers, with range [0, layers()] |
bool Ocean::CV::FramePyramid::replace | ( | const DownsamplingFunction & | downsamplingFunction, |
Frame && | frame, | ||
const unsigned int | layers, | ||
Worker * | worker | ||
) |
Replaces this frame pyramid based on a new frame.
The function will re-used the existing pyramid's memory if possible.
The resulting pyramid will re-used the given frame (as finest pyramid layer); thus, ensure that the frame's memory is valid as long as this pyramid exists.
downsamplingFunction | The custom function used to downsample the individual pyramid layers, must be valid |
frame | The frame for which the pyramid will be created, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
worker | Optional worker object to distribute the computation |
bool Ocean::CV::FramePyramid::replace | ( | const DownsamplingMode | downsamplingMode, |
Frame && | frame, | ||
const unsigned int | layers, | ||
Worker * | worker | ||
) |
Replaces this frame pyramid based on a new frame.
The function will re-used the existing pyramid's memory if possible.
The resulting pyramid will re-used the given frame (as finest pyramid layer); thus, ensure that the frame's memory is valid as long as this pyramid exists.
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
frame | The frame for which the pyramid will be created, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
worker | Optional worker object to distribute the computation |
|
protecteddelete |
Deleted function to prevent confusion between several different replace functions.
|
protecteddelete |
Deleted function to prevent confusion between several different replace functions.
|
protecteddelete |
bool Ocean::CV::FramePyramid::replace | ( | const Frame & | frame, |
const DownsamplingFunction & | downsamplingFunction, | ||
const unsigned int | layers, | ||
const bool | copyFirstLayer, | ||
Worker * | worker | ||
) |
Replaces this frame pyramid based on a new frame.
The function will re-used the existing pyramid's memory if possible.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer) or will just use the memory, depending on 'copyFirstLayer'.
frame | The frame for which the pyramid will be created, must be valid |
downsamplingFunction | The custom function used to downsample the individual pyramid layers, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
bool Ocean::CV::FramePyramid::replace | ( | const Frame & | frame, |
const DownsamplingMode | downsamplingMode, | ||
const unsigned int | layers, | ||
const bool | copyFirstLayer, | ||
Worker * | worker | ||
) |
Replaces this frame pyramid based on a new frame.
The function will re-used the existing pyramid's memory if possible.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer) or will just use the memory, depending on 'copyFirstLayer'.
frame | The frame for which the pyramid will be created, must be valid |
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
|
inline |
Replaces this frame pyramid with a new pyramid defined by the frame type of the finest layer.
The image content of the replaced frame pyramid will be uninitialized.
frameType | The type of the finest pyramid layer, must be valid |
layers | The number of layers to be created during the resizing, the resulting layers will be as many as possible but not exceed this value, with range [1, infinity) |
forceOwner | True, to force the pyramid to be the owner of the memory afterwards; False, to allow that the pyramid is not owning the memory (because the memory is managed outside of this pyramid) |
|
protected |
Replaces this frame pyramid with a new pyramid defined by the frame type of the finest layer.
The image content of the replaced frame pyramid will be uninitialized.
frameType | The type of the finest pyramid layer, must be valid |
reserveFirstLayerMemory | True, to reserve memory for the first pyramid layer (and to initialize the first layer frame); False, to reserve memory for the remaining pyramid layers only (and to skip initializing the first layer frame) |
layers | The number of layers to be created during the resizing, the resulting layers will be as many as possible but not exceed this value, with range [1, infinity) |
forceOwner | True, to force the pyramid to be the owner of the memory afterwards; False, to allow that the pyramid is not owning the memory (because the memory is managed outside of this pyramid) |
bool Ocean::CV::FramePyramid::replace8BitPerChannel | ( | const uint8_t * | frame, |
const unsigned int | width, | ||
const unsigned int | height, | ||
const unsigned int | channels, | ||
const FrameType::PixelOrigin | pixelOrigin, | ||
const DownsamplingMode | downsamplingMode, | ||
const unsigned int | layers, | ||
const unsigned int | framePaddingElements, | ||
const bool | copyFirstLayer, | ||
Worker * | worker, | ||
const FrameType::PixelFormat | pixelFormat = FrameType::FORMAT_UNDEFINED , |
||
const Timestamp | timestamp = Timestamp(false) |
||
) |
Replaces this frame pyramid based on a new frame.
The function will re-used the existing pyramid's memory if possible.
The resulting pyramid will contain a copy of the given frame (as finest pyramid layer).
frame | The frame for which the pyramid will be created, must be valid |
width | The width of the frame in pixel, with range [1, infinity) |
height | The height of the frame in pixel, with range [1, infinity) |
channels | The number of channels the given frame has, with range [1, infinity) |
pixelOrigin | The pixel origin of the given frame |
downsamplingMode | The downsampling mode to use when creating the individual pyramid layers, must be valid |
layers | Number of pyramid layers to be created, with range [1, infinity) |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
pixelFormat | The explicit pixel format which will be used for each pyramid layer, must be compatible with DT_UNSIGNED_INTEGER_8 and 'channels'; FORMAT_UNDEFINED to use a generic pixel format |
timestamp | Timestamp to be assigned to the frame pyramid (e.g., the timestamp of the frame used to created the timestamp) |
|
inline |
Replaces this frame pyramid by a new frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling.
This function is intentionally restrictive to reduce binary impact when used, use other function or the constructor in case more flexibility is needed an binary size does not matter.
The function will re-used the existing pyramid's memory of possible.
This function does not provide the optimal image quality for images with alpha channel, use replace() instead.
frame | The frame for which the pyramid will be created, with 1 plane and data type DT_UNSIGNED_INTEGER_8, should not contain an alpha channel, must be valid |
layers | The number of pyramid layers to be created, with range [1, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
bool Ocean::CV::FramePyramid::replace8BitPerChannel11 | ( | const uint8_t * | frame, |
const unsigned int | width, | ||
const unsigned int | height, | ||
const unsigned int | channels, | ||
const FrameType::PixelOrigin | pixelOrigin, | ||
const unsigned int | layers, | ||
const unsigned int | framePaddingElements, | ||
const bool | copyFirstLayer, | ||
Worker * | worker, | ||
const FrameType::PixelFormat | pixelFormat = FrameType::FORMAT_UNDEFINED , |
||
const Timestamp | timestamp = Timestamp(false) |
||
) |
Replaces this frame pyramid by a new frame with 1 plane and data type DT_UNSIGNED_INTEGER_8 applying a 1-1 downsampling.
This function is intentionally restrictive to reduce binary impact when used, use other function or the constructor in case more flexibility is needed an binary size does not matter.
The function will re-used the existing pyramid's memory of possible.
frame | The frame for which the pyramid will be created, must be valid |
width | The width of the given frame in pixel, with range [1, infinity) |
height | The height of the given frame in pixel, with range [1, infinity) |
channels | The number of channels the given frame has, with range [1, infinity) |
pixelOrigin | The pixel origin of the given frame |
layers | The number of pyramid layers to be created, with range [1, infinity) |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
copyFirstLayer | True, to copy the memory of the first layer into the pyramid; False, to re-use the memory of the first layer only (in this case, ensure that the memory of the first layer exists as long as this pyramid exist) |
worker | Optional worker object to distribute the computation |
pixelFormat | The explicit pixel format which will be used for each pyramid layer, must be compatible with DT_UNSIGNED_INTEGER_8 and 'channels'; FORMAT_UNDEFINED to use a generic pixel format |
timestamp | Timestamp to be assigned to the frame pyramid (e.g., the timestamp of the frame used to created the timestamp) |
|
staticconstexpr |
Returns the size factor of a specified layer in relation to the finest layer.
The finest (first) layer has factor 1, the second layer has factor 2, the third layer has factor 4, ...
layer | The layer to return the size factor for, with range [1, 31] |
|
inline |
Returns the width of a given layer.
layer | The layer to return the width for, with range [0, layers()) |
|
staticconstexpr |
Definition of a value that can be used to create as many pyramid layers as possible (so that the coarsest pyramid layer has resolution 1x1).
|
protected |
The individual layers of this pyramid, zero if not valid.
|
protected |
Optional memory which may be used by at least one pyramid layer.
|
staticconstexprprotected |
The number of bytes for memory alignment.