Loading a large tif file but only first slice is loaded in openCV

Hi ! I’m in a process to write a code in order to process my tiff files .

I manage to load tif files with 20 to 30 slices but when I proceed to work on my original files with 4000 slices only first slice is loaded . I don’t get any type of error. I even proceeded to re-save those files using FIJI image J into tiff files in case the originals were corrupted but same results .

So this print output 1 instead of 4000 slice . Again if I test with small piece of my original file with only 20 slices I get indeed 20 .

etval, mats = cv.imreadmulti(tif, flags=cv.IMREAD_GRAYSCALE)

Opencv version : 4.5.1 Python version : 3.8.3

Any explanation or suggestion would be greatly appreciated .

unfortunately, support for tiff files is quite sparse in opencv.

rather try to use libtiff directly, not the imread() wrappers.

OpenCV must recently have gained the functions imreadmulti and imwritemulti

you seem to have encountered a bug! feel free to submit it as an issue on github (and check if it already exists before submitting)