error using imread from linux
Show older comments
I moved a Matlab script, which processes several tiff files, and a set of test image files from windows to linux. Apparently the imread function is not reading in the tiff files properly under linux. In both operating systems I am using R2010a. The image data which is read from various files seems to be somewhat random and changes from one read event to another. Here is an example:
>> info = imfinfo('0003.tif'); img0 = imread('0003.tif','Info', info); mean(double(reshape(img0,1,[])))
ans = 2.4001e+03
>> info = imfinfo('0003.tif'); img0 = imread('0003.tif','Info', info); mean(double(reshape(img0,1,[])))
ans = 5.4555e+03
As it turns out, the mean, max, and median pixel values change radically from one read to the next, which seems to indicate that imread is grabbing a different set of data each time. This only happens in Linux and seems to be independent of byte ordering, compression, bit depth, etc. But if the tiff file is generated in Matlab, using imwrite, then the read seems to be fine. Has anyone else seen this? Any idea what is going on?
Answers (1)
Jan
on 11 Sep 2012
0 votes
This seems like a bug in Matlab. Or the hard disk is damaged and reply random results. Or some program modifies the file in the background.
I assume, the TIFF import has a bug, which appears for a specific header of the TIFF only, such that files written by IMWRITE are not concerned. If so, send this file to the technical support together with a bug report. A workaround would be to open and rewrite the file in another image manipulation program.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!