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

◆ threshold_adaptive() [2/2]

MAYAFLUX_API std::vector< float > MayaFlux::Kinesis::Vision::threshold_adaptive ( std::span< const float >  gray,
uint32_t  w,
uint32_t  h,
uint32_t  block_size,
float  offset 
)

Adaptive threshold using local block mean minus offset.

Each pixel is thresholded against the mean of its block_size x block_size neighbourhood minus offset. Pixels at the border use a clamped neighbourhood.

Parameters
graySingle-channel float span, size must be w * h.
wImage width in pixels.
hImage height in pixels.
block_sizeNeighbourhood size in pixels. Must be odd and >= 3.
offsetSubtracted from local mean before comparison.
Returns
Binary float vector of length w * h.

Definition at line 290 of file PixelOps.cpp.

293{
294 std::vector<float> out(static_cast<size_t>(w) * h);
295 threshold_adaptive(gray, out, w, h, block_size, offset);
296 return out;
297}
uint32_t h
Definition InkPress.cpp:28
float offset
uint32_t block_size
void threshold_adaptive(std::span< const float > gray, std::span< float > dst, uint32_t w, uint32_t h, uint32_t block_size, float offset)
Adaptive threshold writing into caller-supplied buffer.
Definition PixelOps.cpp:258

References block_size, h, offset, and threshold_adaptive().

+ Here is the call graph for this function: