What does using empty brackets [] in Imshow accomplish?

조회 수: 12 (최근 30일)
David
David 2013년 9월 18일
Hi, I'm working through a piece of example code that I found online. In the code an image file type called fdf is being parsed and the data pulled out so that it can be displayed in matlab using imshow. After the processing is done the final bit of code is:
figure;
imshow(img2,[])
colormap(gray);
axis image;
axis off;
I can't figure out what the empty [] does on the imshow line. The documentation seems to indicate that the only use of square brackets in the imshow method is to give a display range, so what is indicated by empty brackets? I've tried replacing it with [0 0] to no avail.
Removing the brackets or replacing it with 0's results in a black image whereas leaving them in place gives the gray scale image i'm expecting.
Thanks for any help,
David

채택된 답변

Walter Roberson
Walter Roberson 2013년 9월 18일
[] as the display range means to use min() of the data and max() of the data as the display range -- so the data that is actually present is mapped to the full available colormap. Same thing as if you had used imagesc(img2)
  댓글 수: 2
Image Analyst
Image Analyst 2013년 9월 18일
Except that imagesc() applies a funky colormap (that you have to undo with a call to colormap(gray(256)) while imshow() doesn't apply a colormap.
David
David 2013년 9월 18일
Thanks so much!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by