Related functions for Simd::Pyramid structure. More...
Functions | |
| template<template< class > class A> | |
| SIMD_INLINE void | Fill (Pyramid< A > &pyramid, uint8_t value) |
| Fills every level of a pyramid with the given 8-bit value. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | Copy (const Pyramid< A > &src, Pyramid< A > &dst) |
| Copies one pyramid to another pyramid. More... | |
| template<template< class > class A> | |
| SIMD_INLINE void | Build (Pyramid< A > &pyramid, ::SimdReduceType reduceType, bool compensation=true) |
| Builds a gray image pyramid by filling upper levels from the lowest level. More... | |
| Point< ptrdiff_t > | Scale (Point< ptrdiff_t > size, int scale=2) |
| Halves an image size one or more times. More... | |
Detailed Description
Related functions for Simd::Pyramid structure.
Function Documentation
◆ Fill()
| void Fill | ( | Pyramid< A > & | pyramid, |
| uint8_t | value | ||
| ) |
Fills every level of a pyramid with the given 8-bit value.
For each pyramid level the function calls Simd::Fill, which writes value into every byte of image pixel data of that level. Row padding after width*pixelSize is not modified.
- Parameters
-
[out] pyramid - a pyramid to fill. [in] value - a byte value used to fill pixel data of every pyramid level.
◆ Copy()
Copies one pyramid to another pyramid.
- Note
- Input and output pyramids must have the same size.
- Parameters
-
[in] src - an input pyramid. [out] dst - an output pyramid.
◆ Build()
| void Build | ( | Pyramid< A > & | pyramid, |
| ::SimdReduceType | reduceType, | ||
| bool | compensation = true |
||
| ) |
Builds a gray image pyramid by filling upper levels from the lowest level.
Level 0 must already contain the source 8-bit gray image. For every next level the function calls Simd::ReduceGray so that level[i] is a half-size reduction of level[i - 1] (dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2). The reduceType argument selects the reducer: SimdReduce2x2, SimdReduce3x3, SimdReduce4x4 or SimdReduce5x5. The compensation flag is used only for SimdReduce3x3 and SimdReduce5x5.
- Parameters
-
[in,out] pyramid - a pyramid; level 0 is an input image, levels 1..N-1 are outputs. [in] reduceType - a type of function used for image reducing (see SimdReduceType). [in] compensation - a flag to enable rounding compensation before division. It is relevant only for SimdReduce3x3 and SimdReduce5x5. It is equal to true by default.
◆ Scale()
Halves an image size one or more times.
Each halving replaces a side n with (n + 1) >> 1, which is (n + 1) / 2. Odd sides round up: 15 becomes 8, 9 becomes 5, and 1 stays 1. The function receives size by value and returns a new point. A right shift of Point truncates both coordinates; Scale adds 1 before the shift, and that is the size Simd::ReduceGray writes. Pyramid::Recreate calls Scale with the default between consecutive levels.
scale tells how many times the size can be halved. The default is 2, which halves each side once. The value has to be a positive power of two: every step requires the remaining scale to be even and then halves it. A scale less than or equal to 1 returns size unchanged. A scale of 4 halves the size twice.
Motion::Detector calls Scale(size) while it counts how many levels still fit above the top-level size minimum, and calls it again to turn the original frame size into the working frame size. That working size is the base of the texture, difference and ROI pyramids.
- Parameters
-
[in] size - width and height of the image to scale. [in] scale - a positive power of two. The default value 2 halves each side once.
- Returns
- the scaled size.