Understand the color space assumptions in imageproc
mainFunctions in imageproc implicitly assume that pixel colors are stored in a linear color space (e.g., RGB) rather than a non-linear color space (e.g., sRGB).
If you perform operations on non-linear sRGB images without first converting them to a linear space, you may encounter color artifacts. Ensure your input images are in a linear color space before applying processing functions.