IPCV does not read my TIFF image

Dear,

coming from here:

Some comments to IPCV and TIFF.

I remember a discussion about it, which dates back to 2020.

Also, please note that IPCV has a dedicated function tifread().

However this function is dedicated to a very specific tif format.

Probably scicv handles the TIFF format in a more general way.

Best regards,
Philipp

IPCV and IPCV are based on the same library OpenCV, and there is everything in OpenCV to open various types of TIFF files. However imread (in IPCV and scicv) at the Scilab level has a poor API as it does not have the same versatile options as OpenCV’s Imread.
But may I insist : can you post here a TIFF file that IPCV does not read ? I have tested latest version with some example TIFF files and IPCV has read them without any problem.

S.

TIFF files can not be uploaded here.

Hi Philipp,

In imread() a piece of code testing if the image is bitmap is too aggressive. Can you replace the last lines in imread.sci by

    if (size(S,3) == 1 && sum(S==0)+sum(S==255)) == prod(size(S)) 
        S = im2bw(S,0.5);
    end

then execute imread.sci to redefine the function ? Your example tiff image should display as you want:


Next version will include this fix.

S.

Hi Stéphane,

Well, thank you., that worked.

Do I understand correctly:

The TIFF is actually used as a container to hold a RGB bitmap ?

see: https://paulbourke.net/dataformats/tiff/tiff.pdf , page 24.

To not mess around with the existing imread() function:

Would it be possible to define a new IPCV function imread_TiffRGB() or something of that kind?

Not ideal, but maybe a solution to extend IPCV capabilities?

Probably also more a question to Chin Luh Tan .

Best Regards,
Philipp

I don’t see why there could be any mess around with imread(). The actual imread() code was faultly and the proposed patch allows to read RGB TIFF without interfering with other formats. There is no need for a new dedicated function (you can ask Chin Luh Tan if you want, but I mainly maintain IPCV now so he will probably agree for any fix that improves user experience).

S.

Ah, ok. Understood. I thought the change might influence other formats…e.g imread would become tailored to this specific tiff format.