tweak imread+imwrite to work with binary data instead of actual files ("just" skip file reading and writing)
1 view (last 30 days)
Show older comments
dear all, has anybody tried tweaking imread and imwrite to read/write from/to (say uint8) data arrays rather than an actual (say png) file? basically "just" skip the binary file reading and writing in pngreadc (mexfile). background of my question is that i would like to use compressed images in hdf5 files. same applies to mp4 btw. any hint very much appreciated.
i created a very inefficient workaround by using imwrite to tempfile, then read this tempfile as uint8 (to get the data array) and finally delete tempfile.
PS: I contacted MW some time agao and they claimed it cant be done now, but noted feature request
4 Comments
AndresVar
on 10 Feb 2022
In the past I used the method someone else made to read frames from an MRAW recording. Basically just uses fopen, fseek and fread. I have not tried for your purpose but seems like you might be able to get some inspiration from these links:
Reader class for Photron .mraw-Files - File Exchange - MATLAB Central (mathworks.com) See the getFrame method
For what is worth eventually I switch to saving recordings as TIF files, because it was a pain to carry around huge single files (difficult to backup). Depends on how you use your data.
Answers (0)
See Also
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!