How to convert byte array to image in matlab?

11 visualizaciones (últimos 30 días)
Agnes Diza Fahira
Agnes Diza Fahira el 29 de Abr. de 2021
Comentada: Walter Roberson el 6 de Mayo de 2021
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 comentarios
David Hill
David Hill el 29 de Abr. de 2021
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
Agnes Diza Fahira el 3 de Mayo de 2021
it is rgb uint8 3D matrix, the image size is 4000x3000 and it's a color scale.. how to convert into an image again ??

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Mayo de 2021
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 comentarios
Agnes Diza Fahira
Agnes Diza Fahira el 5 de Mayo de 2021
I try this but still error
I try to input YourByteArray with '[B@5faeada1' and didn't change for @byteValue
Error:
Error using arrayfun Unrecognized function or variable byteValue
What is byteValue? And what is YourByteArray?

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by