Closed nznobody closed 2 years ago
This seems to be a problem of fpnge_main, which the python bindings don't use. Nonetheless, fixed :)
Thanks for fixing up fpnge_main
. I am not convinced that this is however the issue. Can you take a quick look at this and determine whey the test test/test_fpnge.py::test_uint16_numpy_random
is failing?
Specifically if I put this into the PNG encoder (a height=1, width=2, channels=3 array):
[[[ 903, 58312, 4628],
[17640, 58450, 32469]]]
I get this out:
[[[ 5138, 51427, 34563],
[54654, 21220, 59460]]]
Note: It works fine with all zeros and all max_uint16.
@animetosho could you check that? I'd hazard it's an issue with the python bindings, but I am not sure -- possibly endianness mismatch?
possibly endianness mismatch?
Without checking and from @nznobody's output, it looks exactly like that.
Converted to hex:
Input
0387 E3C8 1214
44E8 E452 7ED5
Output
1412 C8E3 8703
D57E 52E4 E844
The endianess is flipped, and the channels are as well.
Never had looked into 16-bit PNGs, but since it uses big-endian everywhere, I wouldn't be surprised if this flows onto each sample.
Output image is 8bit from 16bit image input according to
file
and ImageMagickcompare
.Steps to reproduce:
Note: the 12b-out.png claims to be
8-bit/color
. Interestinglyopencv
reads this still as 16-bit, but wrongly.Extra Info:
CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz OS: Debian GNU/Linux 11 (bullseye) (in docker) Compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110 g++ (Debian 10.2.1-6) 10.2.1 20210110
Extra extra
I stumbled on this via the python binding here. Below is an example out showing the errors:
Images: