I want to mimic behavior of PIL.Image.resize(…,interpolation=PIL.Image.ANTIALIAS). What I would like to expect, is to have matching pixel vales (~99.9% exact match should be fine) . How can I do this with OpenCV ? I tried Opencv resize with available interpolation methods (including LANCZOS4) , but result does differ from the one I got from PIL.
Why I’m doing this? Well I 'm developing machine learning program in C that is using (infer) pre-trained model (done in Python+PIL with PIL.Image.ANTIALIAS). Even small differences in preprocessing of images has an impact on how machine learning model behave.
So either I find a way to achieve same resize behavior in OpenCV as used in PIL.Image.ANTIALIAS or how to use PIL in C.
One major difference: The output of operations is completely different. In Pillow, you set radius, while in cv you set kernel size, which is literally diameter. You should use ksize=(7, 7) to achieve the same result.