필터 지우기
필터 지우기

m by 1 array of uint8 data to image

조회 수: 3 (최근 30일)
Jason Allnutt
Jason Allnutt 2016년 3월 1일
답변: Walter Roberson 2016년 3월 13일
I want to display an image from my device. Currently i can read in the image using binblockread of type unit8 and print the image to a fie using fwrite and it displays fine.
However, I would like to display the image in MATLAB first for a user prompt i'm developing. The array is read into MATLAB as an m by 1 array ranging from 0 to 255. I have tried imshow, imagesc, and image. As well as playing with the different parameters but nothing wants to take.
Perhaps someone could help. I have attached the array I am reading into to matlab. THis is the same array i'm using to print to my .gif file.
  댓글 수: 5
Walter Roberson
Walter Roberson 2016년 3월 2일
Looking at that code, Yes, what you are receiving must already be in image file format. If you were to hunt around long enough you could probably find a Java or library that could accept an array of bytes that is the image file data, and which would decode the image file data into the pixel arrays so that you could display them... but it would be easier to write the file and read it with imread()
Jason Allnutt
Jason Allnutt 2016년 3월 2일
Hey Walter,
Thanks for the quick response. Yes I went ahead and did as you suggested. It is actually a fine solution. I don't see the delay or issues I was concerned about. Thanks so much.
I guess cause this was a comment I can't "accept" your answer. But I certainly do appreciate it. Thank you.
-Jason

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 13일
Looking at that code, Yes, what you are receiving must already be in image file format. If you were to hunt around long enough you could probably find a Java or library that could accept an array of bytes that is the image file data, and which would decode the image file data into the pixel arrays so that you could display them... but it would be easier to write the file and read it with imread()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by