Decode to RGB failue
I decoded a jp2 image to RGB and get the results. But the results are not accurate. it decoded red, but in blue and green it could not decode. I use another OPENJPEG library and it gives correct results "https://github.com/kripken/j2k.js". this is my image: https://drive.google.com/file/d/1A4k7p2nYMom-ytksrnPbs-JUfsB74keD/view?usp=sharing
I don't know exactly why the problem happened, do you know how to fix it? thanks,
FIREFOX: The page isn’t redirecting properly
winfried
ngoclinh93qt @.***> hat am 19. März 2021 um 08:49 geschrieben:
I decoded a jp2 image to RGBa and get the results. But the results are not accurate. it decoded red, but in blue and green it could not decode. I use another OPENJPEG library and it gives correct results "https://github.com/kripken/j2k.js". this is my image: https://drive.google.com/file/d/1A4k7p2nYMom-ytksrnPbs-JUfsB74keD/view?usp=sharing — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uclouvain/openjpeg/issues/1335 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGOZDL4EB2COEM32TRBOCTTEL6ZNANCNFSM4ZOIQODQ .
@ngoclinh93qt , on LINUX the browser firefox failed to download. On WIN10 the browser edge failed to downlowed. firefox on WIN10 downloaded a file name eye.jp2. But this file is not RGBA but:
read_colr meth(1)
meth(1) prec(0) approx(0) enumcs(18)sYCC
This link you gave is really funny. The resulting image eye.jp2 did not give an eye of type RGBA but a tiled floor. winfried
Hmmm, well, first of all this is lossy sYCC (EnumCS 18), which is ONLY full range inside JPEG 2000.
It is different from YCbCr_1 (EnumCS 1) which is limited range, uses ITU BT.709-4 primaries and BT.601-5 matrix, different from YCbCr_2 (EnumCS 3) that uses full range and BT.601 matrix (RGB is then ICC defined, AFAIK) and different from YCbCr_3 (EnumCS 4) that uses limited range and ITU-R Rec. BT.601-5 colorspace (PAL or NTSC, BTW???) and matrix.
sYCC uses BT.601-5 matrix but with 4 digits after decimal, but the R'G'B' that you will get from decoding will be sRGB, which is rather different from BT.709 colorspace, uses different transfer and does not use BT.1886 as its EOTF, as sRGB is already an EOTF. And most importantly you do not need to do anything with it as sRGB is the default R'G'B' anyway. With YCbCr_1 you will have to manage it to sRGB by changing the transfer function.
it decoded red, but in blue and green it could not decode
Can you elaborate? FFmpeg's native (jpeg2000) and FFmpeg's libopenjpeg decoders produced picture that is different in 60 pixels or something. It is not that bad, though unfortunate of course. opjdecompress produced very different from it picture though, yeah. There are at least a couple of bugs here. Alas.
Photoshop also decodes that differently. Sigh.
@ValZapod I can't change the encoding for the image because I got it through a third party. I tried to decode it with J2k.js library and got the correct result, this library was compiled from OPENJPEG as well. I don't know much about image encoding so I don't know why it's faulty.
I don't know why it's faulty.
Because it uses very rare sYCC color space. That is why.
Please attach the j2k.js ouput right here (drag and drop). Preferably in png. Thanks.
BTW, it is a very old library you are using, though of course that rendering in C compiled to Javascript is cool. See https://acdha.github.io/jp2-polyfill/demo.html