mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 12:12:06 -06:00
Replace the std::pow calls with repeated multiplication (decolorPow), which for exponents 0/1/2 is the exact same arithmetic, not an approximation. Take row pointers (Mat::ptr) instead of Mat::at in both polynomial loops. Transpose dest/dest1 once in gradvector and read them row-major instead of walking columns. Thread the full-resolution pass in grayImContruct with parallel_for_ over image rows, the polynomial terms are gathered once up front and each row accumulates independently, so the result is scheduler-independent. Below the element-count cutoff it runs as a single invocation. Added a perf test (modules/photo/perf/perf_decolor.cpp).