Decompress binary image files
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have set of binary files each of which is compressed. Each file is a matrix of size 1024*768, uint32.The file is in specific format called hnd files. I would like to know whether Matlab could be of any help to me. AS such I cannot open the file in Matlab as it is compressed. But should be open once it is decompressed using ‘fopen’. Your help is much appreciated.
2 Kommentare
Akzeptierte Antwort
Image Analyst
am 10 Aug. 2012
If MATLAB's imread() can't read it, and you can't find a reader for it in the File Exchange, then you'll have to write one with fopen(), fread(), and fclose() like you mentioned. If you don't know the format, you can guess at the number of rows and columns until your image does not look interlaced or skewed anymore. Most formats have a header of some length, followed by the pixels. You might be able to figure out pretty closely where the header ends by opening up the image file in a binary/hex editor and seeing where the number pattern changes. Then skip that number of bytes with fseek() and read in with fread(). Change the number of rows and columns you pass in to get rid of the skew.
2 Kommentare
Image Analyst
am 10 Aug. 2012
Bearbeitet: Image Analyst
am 10 Aug. 2012
I may or may not get around to doing anything with it this weekend, but you can upload it. http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers. But if it's not just simply the bytes written out - like it's some kind of funky compression scheme - I won't be able to do anything. Why don't you ask whomever gave you the file if they will give you the format, or see if you can export the files to a standard format instead?
Weitere Antworten (1)
Walter Roberson
am 10 Aug. 2012
2 Kommentare
Walter Roberson
am 10 Aug. 2012
The Varian hnd file format appears to be specific to Varian, and the compression algorithm is not one I have seen anywhere else. You are not likely to find any pre-written MATLAB routine to do the work. It is possible to write a MATLAB routine to handle it, but easier would likely be to use the existing C++ plastimatch routines from http://forge.abcd.harvard.edu/gf/project/plastimatch/scmsvn/?action=browse&path=%2Fplastimatch%2Ftrunk%2Fsrc%2Fplastimatch%2Fbase%2Fhnd_io.cxx&revision=3395&view=markup&pathrev=3395 . Plastimatch is open source.
Siehe auch
Kategorien
Mehr zu Language Support finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!