Ask Your Question

to open file .tif 1bit with imread cause access violation

asked 2015-11-15 23:27:58 -0600

ell gravatar image

updated 2015-11-15 23:29:43 -0600

I try to read .tif file 1bit (black&white) with imread :

  1. FF = "D:\Scan\num-03-1.tif";
    image = imread(FF,0); // Read the file
    and got :
    Unhandled exception at 0x0f76ac87 in CV.exe: 0xC0000005: Access violation writing location 0x0042e428.
    tried all parameter possibilities.

  2. if I save the file as .png 1bit :
    FF = "D:\Scan\num-03-1.png";
    the imread , read ok !

  3. if I save the file as .tif 8bit (grayscale):
    FF = "D:\Scan\num-03-8.tif";
    the imread , read ok !

so the question is :
can imread open 1bit .tif files ?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-20 10:39:11 -0600

It seems not. I've been having this issue recently as well. Due to 1-bit PNGs working correctly, it seems likely that this is an unhandled case with the TIFF Reader.

Also, keep in mind that cv::Mat's don't support 1-bit images anyway and will get converted to 8-bits by default.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-11-15 23:27:58 -0600

Seen: 482 times

Last updated: Nov 15 '15