different results on Android platform while using Imgcodecs.imread() and Utils.BitmapToMat()

asked 2020-03-31 03:32:13 -0500

I try to use opencv to read the same JPEG image through 2 wises

   1. First to get the bitmap class of the image, then using the Utils.BitmapToMat() to get the Mat class

image description

   2. Directly using  Imgcodecs.imread() to get the Mat class of image.

image description

Acctually the values of pixels are not complete identical. such as following:

w=0, h=0, R=177.00, G=188.00, B=192.00 // BitmapToMat

w=0, h=0, R=178.00, G=187.00, B=192.00 // imread

Second Part

I try also to read the same image on the PC platform with library opencv-python, and comparing the results between android and PC, as following:

image description

why occurs differences between android and PC while reading image directly from the absolute path. Otherwise, they are identical by a converting processing (BitmapToMat).

edit retag flag offensive close merge delete


jpeg is lossy, and using different libraries will result in slightly different images.

so, if you need something bit-exact, prefer .png or plain .bmp

berak gravatar imageberak ( 2020-03-31 08:31:48 -0500 )edit