Use of square brackets

조회 수: 5 (최근 30일)
Lab Rat
Lab Rat 2012년 11월 25일
I know this sounds a silly question, but what is the difference between using imshow(X); and using imshow(X,[]); ? For some images, I'm unable to display them using the first command.

답변 (1개)

Image Analyst
Image Analyst 2012년 11월 25일
You use [] to scale the image to the range 0-255. This will maximize the contrast. If you have a double or single image, then it expects the range to be 0-1. If your image is not in that range, then it will show as all white or all black depending on if it's more than 1 or less than 1. For example, if your image goes from -242.99 to +5782.123, then it will set -242.99 to 0, and 5782.123 to 255 and linearly scale everything in between.
  댓글 수: 2
Lab Rat
Lab Rat 2012년 11월 26일
Thanks. Is there any MATLAB function that will autoscale a double image back to the minimum as 0 and maximum as 1 ? Or do I have to use X = X - min(X); X = X/max(X); ?
Image Analyst
Image Analyst 2012년 11월 26일
You can look into imadjust() or mat2gray().

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by