what is the difference between image and imshow ?

조회 수: 103 (최근 30일)
matar maoz
matar maoz 2011년 2월 13일
While reading the MATLAB Help, I ran into the functions "image()" and "Imread".
From what I see, those functions do the same thing.
What is the difference?
Matar

채택된 답변

Brett Shoelson
Brett Shoelson 2011년 2월 13일
image is a MATLAB command that visualizes your matrix as simply a matrix of numbers. The colors used to represent each value might be meaningless to the representation of the matrix as an image.
imshow is an Image Processing Toolbox command that treats your matrix as an image. It assumes that the elements are pixel intensities, and that you might want more control over the colormap, you probably don't want grid lines or axes tick marks, and you probably want to maintain the aspect ratio.
Consider:
img = imread('cameraman.tif');
figure;
image(img)
Colors are meaningless; even applying a seemingly reasonable colormap might give you unexpected results.
set(gcf,'colormap',gray);
Now consider:
figure;
subplot(1,2,1);
image(img);
subplot(1,2,2);
imshow(img)
Even with the colormap established by the matrix-as-image, image gives you behavior you don't necessarily want from an image viewer. Cheers,
Brett
  댓글 수: 1
matar maoz
matar maoz 2011년 2월 18일
thanke you very muce.
the answer is great!
the image function is a function of intensities, then, being visualized with colors.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 2월 18일
Bah, the only difference I see is the "axis image" and turning the ticks off, both of which are easy enough to do with image() without requiring the Image Processing Toolbox
I also found it quite easy to break the functionality of imshow(). It happened several times in a row for me. Unfortunately I can't reproduce it in an independent test.
  댓글 수: 1
Brett Shoelson
Brett Shoelson 2011년 3월 5일
Of course you can view your image without the Image Processing Toolbox! If you don't have that tool, then by all means that is the thing to do. But if you do have the IPT, IMSHOW just streamlines the "proper" display of images.
Walter, I'd be very interested in seeing _how_ you've broken IMSHOW, if you can ever reproduce it!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by