-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equivalent to OpenCV cv2.INTER_LINEAR
#32
Comments
Do you ask about downscaling or upscaling? |
As I understand, OpenCV uses "convolution" with fixed kernel size. In this case, downscaling very big image into very small one looks like a result of nearest "interpolation".
|
Downscaling is more important but I would ideally I would like both. Yes, I see the results are visually better. But my goal is to reproduce a pipeline written in Python that uses OpenCV. I need exactly same results as in the OpenCV, no matter which ones look better. |
I can try to implement a fixed kernel size, but I'm not sure if that would be enough to get exactly the same results. The result also depends on how a particular solution handles rounding of numbers, accuracy of intermediate calculations and other things. |
Hello, can I ask you about some rough time estimate for this? Alternatively if you don't have time for it, I can try implementing it myself and send it to you for review. |
I think I can do it for about 5-7 days. But I don't know what name to give these resizing methods. |
I think both names you suggested make sense, I don't have any other idea. |
I implemented |
Perfect thanks. I will try it later. |
I will publish this version on crates.org within 1-2 days. |
I released version 4.2.0 |
Hello, I have tested the solution. The results are closer to these of OpenCV, but there are still some small +1/-1 differences. These are probably due to rounding as you said in your previous comment. I am posting a reproducible example:
After running
and a sligthly different output from running the rust code:
The differences are at most 1. For my usecase it would be the best to have a complete compatibility but I guess that is not a goal of this library. I don't know yet whether I will use the |
Hello is it possible to achieve exactly same results with this library as if I was using
cv2.resize
withinterpolation=cv2.INTER_LINEAR
from OpenCV?I tried using
Resizer::new(Convolution(Bilinear))
but the pixel values in the resulting image are slightly different.Thanks
The text was updated successfully, but these errors were encountered: