MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ downsample_2x() [3/3]

MAYAFLUX_API std::vector< float > MayaFlux::Kinesis::Vision::downsample_2x ( std::span< const float >  src,
uint32_t  w,
uint32_t  h,
uint32_t &  new_w,
uint32_t &  new_h 
)

2x box-filter downsample.

Each output pixel is the average of the corresponding 2x2 block in src. Output dimensions are floor(w/2) x floor(h/2). Odd-dimension remainders are dropped. new_w and new_h are written before return.

Parameters
srcSingle-channel float span, size must be w * h.
wInput width in pixels.
hInput height in pixels.
new_wReceives output width (floor(w/2)).
new_hReceives output height (floor(h/2)).
Returns
Downsampled float vector of length new_w * new_h.

Definition at line 516 of file PixelOps.cpp.

520{
521 new_w = w / 2;
522 new_h = h / 2;
523 std::vector<float> out(static_cast<size_t>(new_w) * new_h);
524 downsample_2x(src, out, w, h, new_w, new_h);
525 return out;
526}
uint32_t h
Definition InkPress.cpp:28
void downsample_2x(std::span< const float > src, std::span< float > dst, uint32_t w, uint32_t h, uint32_t &new_w, uint32_t &new_h)
2x box-filter downsample writing into a caller-supplied buffer.
Definition PixelOps.cpp:443

References downsample_2x(), and h.

+ Here is the call graph for this function: