You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cv2.imread in different versions should return same values for the same JPG file.
Actual behaviour
For this image(w=153, h=209), pixel[0, 207] will get different value between 3.3 and 3.4
In 3.3, pixel[0, 207] = [115, 52, 226]
In 3.4, pixel[0, 207] = [111, 52, 223]
Steps to reproduce
example code import cv2 print(cv2.__version__) img = cv2.imread('001.jpg') print(img[0, 207])
Though the libjpeg-turbo has better performance than libjpeg, this difference will make a TRAP, and cause some machine learning models give DIFFERENT results for same input file. We've trained a model in v3.3, but got a wrong test result in v3.4 for that beauty pic.
The text was updated successfully, but these errors were encountered:
Hmm, I thought that I already wrote a reply here but apparently I didn't...
Anyhow, I can confirm that there seems to be differences between these libraries. Most likely the issue is related to the optimizations which have been done in libjpeg-turbo. I have no way of knowing what might cause these differences but I presume that different decoding algorithms are used under the hood. In addition, the usage SIMD extensions might cause some inaccuracies to the results. Due to the nature of the JPEG's lossy format there's no way to "fix" this issue.
I'll be changing also macOS and Windows jpeg libs to libjpeg-turbo at some point. You can always compile OpenCV by yourself if you need extremely stable environment. I hope you understand that I cannot guarantee that these builds remain consistent across releases.
Expected behaviour
cv2.imread in different versions should return same values for the same JPG file.
Actual behaviour
For this image(w=153, h=209), pixel[0, 207] will get different value between 3.3 and 3.4
In 3.3, pixel[0, 207] = [115, 52, 226]
In 3.4, pixel[0, 207] = [111, 52, 223]
Steps to reproduce
import cv2
print(cv2.__version__)
img = cv2.imread('001.jpg')
print(img[0, 207])
linux
x64
3.4
I have tested the libjpeg and libjpeg-turbo, and this difference is caused by these two libs. (Test code in https://github.com/Marco-LIU/libjpeg-test)
Though the libjpeg-turbo has better performance than libjpeg, this difference will make a TRAP, and cause some machine learning models give DIFFERENT results for same input file. We've trained a model in v3.3, but got a wrong test result in v3.4 for that beauty pic.
The text was updated successfully, but these errors were encountered: