I was looking for this functionality for some time, but all file exchange submissions seem to be some custom decoders
Then on stackoverflow I found a snippet which uses java for decoding: http://stackoverflow.com/questions/18659586/from-raw-bits-to-jpeg-without-writing-into-a-file
This snippet worked for me and I am submitting it as a function here.
% get a stream of bytes representing an endcoded JPEG image
fid = fopen('football.jpg', 'rb');
data = fread(fid, Inf, '*uint8');
% decode jpeg
img = decodeJpeg(data);
% check results against directly reading the image using IMREAD
img2 = imread('football.jpg');
Evgeny (2020). decodeJpeg (https://www.mathworks.com/matlabcentral/fileexchange/53716-decodejpeg), MATLAB Central File Exchange. Retrieved .
It works also for PNG files! 2019a
Its a great approach.
If you know actual algorithm(what java object are doing) which converts raw bits to image.
Can you please share.
Because, may be the performance can be further improved by utilising GPU power.
Just I need, and worked pretty well!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!