How to convert byte array to image in matlab?
显示 更早的评论
i have been convert an image to byte array in java and i have
byte array = [B@5faeada1
now i want to convert that byte array to image in matlab, how to do it??
2 个评论
David Hill
2021-4-29
When you say a byte array, is it a rgb uint8 3D matrix? or a 1D array of hexidecimal digits? If so, you will need to know the image size and whether the image is color or just gray scale.
Agnes Diza Fahira
2021-5-3
回答(1 个)
Walter Roberson
2021-5-3
reconstructed_image = reshape(typecast(int8(arrayfun(@byteValue, YourByteArray)),'uint8'), [4000, 3000, 3]);
There might well be better ways: this is the way I could get to work.
2 个评论
Agnes Diza Fahira
2021-5-5
Walter Roberson
2021-5-6
Are you looking for something similar to https://www.mathworks.com/matlabcentral/fileexchange/53716-decodejpeg ?
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!