Load only part(block) of a large bmp-image in order to reduce memory requirements
1 次查看(过去 30 天)
显示 更早的评论
Hello, I want to process bmp-images without a lot of "memory requirement". The file size is about 300 MB and matlab seems to acquire 1.5 GB whereas the peak memory seems to be about 350 MB (using matlab profiler with the memory options)
As I only use/need a small part of the image (only about 3000 columns instead of 8000), I wonder if it's somehow possible to load only this part of the image.
One goal is to reduce the processing speed and the amount of acquired memory when I compile the matlab code into an exe or jar-file.
I'm very happy about every code fragment or ideas.
Thank you
Andreas
0 个评论
采纳的回答
Walter Roberson
2016-12-20
You might want to adapt the C code shown in http://stackoverflow.com/questions/14279242/read-bitmap-file-into-structure to not read the full image, either by using fseek() to re-position the input stream or by reading more than you need and throwing away the extra.
0 个评论
更多回答(1 个)
Kushagr Gupta
2016-12-20
The 'imread' function in MATLAB lets one read subimages for TIFF and JPEG2000 formats. So one way to go about this issue would be to covert the BMP images into TIFF and reading the small part of the image thereafter in MATLAB using the 'imread' function with 'PixelRegion' argument.
Go through the 'PixelRegion' section of the 'imread' documentation available at:
Can you tell us more about the source of such large BMP images, as usually only JPEG2000 and TIFF images come in such sizes and it would be interesting to know the use case.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!