ssimulacra icon indicating copy to clipboard operation
ssimulacra copied to clipboard

Not working with 16-bit images

Open trougnouf opened this issue 5 years ago • 1 comments

ssimulacra doesn't seem to work with 16-bit images

$ ssimulacra img1.ppm img2.ppm 
OpenCV Error: Assertion failed ((lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S)) in LUT, file /home/trougnouf/.cache/pacaur/opencv2/src/opencv-2.4.13.6/modules/core/src/convert.cpp, line 1213
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/trougnouf/.cache/pacaur/opencv2/src/opencv-2.4.13.6/modules/core/src/convert.cpp:1213: error: (-215) (lutcn == cn || lutcn == 1) && lut.total() == 256 && lut.isContinuous() && (src.depth() == CV_8U || src.depth() == CV_8S) in function LUT

Aborted (core dumped)

as a side-note opencv > 2 doesn't seem to be supported (worth mentioning in the readme)

trougnouf avatar Oct 18 '19 09:10 trougnouf

Yes, it currently only works on 8-bit sRGB images, because the conversion to Lab space is hardcoded for that. Using lcms it could be done to take arbitrary bit depth and color profiles as input, but for now you should convert the images to be tested to 8-bit sRGB (e.g. convert img1.ppm -depth 8 img1-8bit.ppm, assuming the ppm is in sRGB already).

jonsneyers avatar Oct 21 '19 07:10 jonsneyers