tweak imread+imwrite to work with binary data instead of actual files ("just" skip file reading and writing)

1 view (last 30 days)
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
Roman Koetitz
Roman Koetitz on 9 Feb 2022
sorry didnt read your /dev/shm hint carefully enough first, yes a ramdisk might be an inexpensive compromise, havent used it under windows yet though
AndresVar
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:
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.

Sign in to comment.

Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!