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

◆ dilate()

MAYAFLUX_API double MayaFlux::Kinesis::Discrete::dilate ( std::span< const double >  window,
std::span< const double >  coefs 
)
noexcept

Maximum over the window of window[k] + coefs[k], the grayscale dilation.

coefs are the offsets of the structuring element. Runs over the shorter of the two; empty gives zero.

Definition at line 369 of file Kernels.cpp.

370{
371 const size_t count = std::min(window.size(), coefs.size());
372 if (count == 0)
373 return 0.0;
374
375 double b0 = window[0] + coefs[0];
376 double b1 = b0;
377 double b2 = b0;
378 double b3 = b0;
379 size_t k = 1;
380 for (; k + 4 <= count; k += 4) {
381 b0 = std::max(b0, window[k] + coefs[k]);
382 b1 = std::max(b1, window[k + 1] + coefs[k + 1]);
383 b2 = std::max(b2, window[k + 2] + coefs[k + 2]);
384 b3 = std::max(b3, window[k + 3] + coefs[k + 3]);
385 }
386 for (; k < count; ++k)
387 b0 = std::max(b0, window[k] + coefs[k]);
388 return std::max(std::max(b0, b1), std::max(b2, b3));
389}
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
size_t count

References count, and window.