imshow(image) and imshow(image,[])

what is the difference between imshow(image) and imshow(image,[]) I am getting different images for this different lines, but I am not getting the logic behind it, can anybody help me for this...

4 Comments

Al Bashir
Al Bashir on 9 Feb 2017
Edited: Al Bashir on 9 Feb 2017
imshow(I) (I = image) imshow(I) displays the image I in a graphics figure, where I is a grayscale, RGB (truecolor), or binary image. For binary images, imshow displays pixels with the value 0 (zero) as black and 1 as white.
imshow(I,[]) imshow(I,[low high]) displays the grayscale image I, specifying the display range as a two-element vector, [low high]. For more information, see the DisplayRange parameter .
Display range of a grayscale image, specified as a two-element vector [LOW HIGH]. imshow displays the value low (and any value less than low) as black, and the value high (and any value greater than high) as white. Values in between are displayed as intermediate shades of gray, using the default number of gray levels. If you specify an empty matrix ([]), imshow uses [min(I(:)) max(I(:))]; that is, the minimum value in I is black, and the maximum value is white.
Guillaume
Guillaume on 9 Feb 2017
Edited: Guillaume on 9 Feb 2017
Al Bashir, you should post your answer as an actual answer below. That way, Ajay can accept your answer and you get reputation. Plus, Ajay will be notified that an answer has been posted. Comments don't get notified, so he/she probably doesn't even know you've answered his question.
@Somaye Ahmadi: Flags are used to inform the admins and editors about contributions, which might conflict with the terms of use, e.g. by rudeness or illegal content. Please do not use them to post comments. Thanks.
@Jan Simon: Thanks for your comment. I didn't know. I'm so sorry.

Sign in to comment.

 Accepted Answer

If you type "help imshow" or "doc imshow", you can read what Al Bashir said in his comment. In my copy of Matlab the first lines of the help read:
imshow(I) displays the grayscale image I.
imshow(I,[LOW HIGH]) displays the grayscale image I, specifying the display
range for I in [LOW HIGH]. The value LOW (and any value less than LOW)
displays as black, the value HIGH (and any value greater than HIGH) displays
as white. Values in between are displayed as intermediate shades of gray,
using the default number of gray levels.
imshow(I,[]) displays the grayscale image I scaling the display based
on the range of pixel values in I. imshow uses [min(I(:)) max(I(:))] as
the display range, that is, the minimum value in I is displayed as
black, and the maximum value is displayed as white.
imshow(RGB) displays the truecolor image RGB.

10 Comments

Somaye Ahmadi
Somaye Ahmadi on 2 Oct 2017
Edited: Somaye Ahmadi on 2 Oct 2017
May I ask you something?What is your Matlab version?
The help of my Matlab doe not have that!!!!
Thanks
@Somaye Ahmadi: You can use the online docs of the current version: https://www.mathworks.com/help/images/ref/imshow.html There you find, that this command is part of the Image Processing Toolbox. Do you have it?
Somaye Ahmadi
Somaye Ahmadi on 19 Oct 2017
Edited: Somaye Ahmadi on 19 Oct 2017
@Jan Simon, many thanks for your reply and the link...it's so useful,thank you so much. No I don't,I should update my Matlab to newer version! Thanks
Updating your Matlab version will very likely not help. The Image Processing Toolbox is a toolbox, which is the name for a package of functions that is licensed separately from the main program. So it depends on your license, not your release. (unless of course you are using an ancient release from before the introduction of this toolbox, but I doubt you'dd get a release that old to work on something later than Windows XP)
@Rik Wisselink:Thanks for your reply.Thanks
Not clear
@Ayman, what is not clear?
imshow is part of base Matlab. Maybe it was in the Image Processing Toolbox once, but I don't remember it being.
There is indeed also a doc page for the base Matlab function: here. Interesting to see the differences with the IPT version of the doc. Anyway, either contains the part I quoted.

Sign in to comment.

More Answers (0)

Categories

Find more on Display Image in Help Center and File Exchange

Tags

Asked:

on 16 Mar 2016

Commented:

Rik
on 10 Jul 2018

Community Treasure Hunt

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

Start Hunting!