MayaFlux 1.0.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 496 of file PixelOps.cpp.

500{
501 new_w = w / 2;
502 new_h = h / 2;
503 std::vector<float> out(static_cast<size_t>(new_w) * new_h);
504 downsample_2x(src, out, w, h, new_w, new_h);
505 return out;
506}
uint32_t h
Definition InkPress.cpp:29
const uint32_t * src
std::vector< float > * out
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:423

References downsample_2x(), h, out, and src.

+ Here is the call graph for this function: