I have a 1*784 matrix, I need to convert it to a 28*28 image, can anyone please tell me how to do it?I used reshage, imagesc for this, but the picture doesn't seem right, any suggestions would be a great help. I'm attaching a file which contains X_train which contains pixels of 12,000 images as row vectors, I'm supposed to study the 12,000th image, it is a 9, but I'm getting some weird shape.
Thank You

 채택된 답변

Walter Roberson
Walter Roberson 2018년 3월 4일

1 개 추천

images = permute(reshape(uint8(X_train),12000,28,28),[3 2 1]);
image(images(:,:,12000)); colormap(gray(256));

추가 답변 (2개)

Jahnavi Mrudula Mudduluru
Jahnavi Mrudula Mudduluru 2018년 3월 4일

0 개 추천

It works.
Thanks a lot!!!!
Fatih Sandayuk
Fatih Sandayuk 2019년 12월 28일

0 개 추천

hello!
how did you studied the 12 000th picture? I have the same Problem, but matlab says taht unit 8 is not defined.
THANK YOU!

댓글 수: 1

Walter Roberson
Walter Roberson 2019년 12월 28일
You might have accidentally typed unit8 instead of uint8

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

카테고리

도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by