Skip to content
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

jpg's RGB value changed using different opencv versions (3.3 v.s. 3.4) #10641

Closed
Marco-LIU opened this issue Jan 19, 2018 · 4 comments
Closed
Labels
category: imgcodecs invalid question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@Marco-LIU
Copy link

System information (version)
  • OpenCV => 3.4
  • Operating System / Platform => linux
  • Compiler => gcc
Detailed description

The jpg's RGB value decoded by imread (in 3.4) is different with 3.3

Steps to reproduce

001
For this jpg, using python cv2.imread, fetch RGB value img[207,0]
3.3 will return [115, 52, 226]
3.4 will return [111, 54, 223]

@alalek
Copy link
Member

alalek commented Jan 19, 2018

OpenCV uses libjpeg to read JPEG images. Check used versions via cv::getBuildInformation().
OpenCV can use system libjpeg (preferred way, you need to install "dev" package via system package manager) or it uses builtin sources of libjpeg from 3rdparty directory (code is updated between 3.3 / 3.4).

JPEG is not a lossless format in general, so don't expect bit-exact values on different platforms / different software versions.

Usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org
This tracker is for issues and bugs that needs fix in OpenCV.

@Marco-LIU
Copy link
Author

Thanks for your reply, @alalek
It seems come from the change of Libjpeg.

Just make a mark for this pit:
"If you get different result with same model and same input file in different platform, CHECK the opencv VERSION"

Hope can help others

@sturkmen72
Copy link
Contributor

@alalek i think a typo here "JPEG is lossless"

@Marco-LIU
Copy link
Author

This problem comes form opencv-python building. For opencv-python 3.4, it use libjpeg-turbo instead of libjpeg for better performance. These two jpeg libs will give different results for the same jpg file.

Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: imgcodecs invalid question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests

3 participants