Incorrect reading of Jpeg2000 images with unstandard encoding

asked 2018-01-26 07:52:07 -0600

Hi, I am trying to read Jpeg2000 images with an unstandard 15-bit encoding in Python. More precisely I am trying to read Sentinel-2 L1C satellite images provided by ESA. I am using the following code

```Python import cv2

image = cv2.imread('./B01.jp2', cv2.IMREAD_UNCHANGED) ````

The code works and I don't get any errors or warnings but the obtained image values are 2 times higher that they should be. Looks like the image is read as it would have 16-bit encoding and all values are multiplied by 2.

If I read the same image with Glymur package the obtained image values are correct (and not 2 times higher as with OpenCV):

``` import glymur

image = glymur.Jp2k('./B01.jp2')[:] ```

I would like to know if there is a bug/error in OpenCV or are these kind of encodings just not supported?

Here is link where you can download Sentinel-2 images I am trying to read: http://sentinel-s2-l1c.s3-website.eu-...

edit retag flag offensive close merge delete