matlab code

조회 수: 3 (최근 30일)
noor
noor 2012년 1월 15일
hiii i need a matlab code on how to view a matrix as an image ???? we have a matrix and i need to view it as image

채택된 답변

Chandra Kurniawan
Chandra Kurniawan 2012년 1월 15일
Hi,
You can use imagesc command from Matlab
A = [ 0 1 1 1 0;
0 1 1 1 0;
0 0 1 0 0;
0 0 1 0 0;
1 1 1 1 1;
0 0 1 0 0;
0 0 1 0 0;
0 1 1 1 0;
1 0 0 0 1];
imagesc(A); colormap(gray);
axis square;
  댓글 수: 2
noor
noor 2012년 1월 15일
hi... thank u so much
i'm new in matlab so I will bother you a little bit
if i have an image form matlab how can i convert it to matrix and then use that matrix to view it back into image ???
Chandra Kurniawan
Chandra Kurniawan 2012년 1월 15일
You can use command 'imread' to read image from disk.
Eq :
I = imread('C:\Document\nasa.jpg');
In the Matlab workspace, I will threaten as matrix.
Then If you want to convert it back to image, you can use 'imwrite' command from Matlab
Eq:
I = imread('C:\Document\nasa.jpg');
imwrite(I,'picture001.bmp','bmp');

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by