Thread Subject: How to create the effect of [ ] in "imshow(img,[ ])"

Subject: How to create the effect of [ ] in "imshow(img,[ ])"

From: Volker Klink

Date: 19 May, 2008 16:22:02

Message: 1 of 4

Hi all!

I guess this must be very simple but apparently it's too
complicated for me (or it's too late to be still in the
lab....).
I would like to manipulate image data in the same way as
"imshow" does, when u call it with [ ]. So I want the same
appearance of the image regardless how i call imshow...
The MatLAb help says:

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. If
you use an empty matrix ([]) for [low high], imshow uses
[min(I(:)) max(I(:))]; that is, the minimum value in I is
displayed as black, and the maximum value is displayed as white.

I tried to stretch the histogramm manually so the minimum
value in would be zero and the maximum value = 255 (similar
to imadjust(I)) does but that doesn't work.
Anyone has ac lue?
Thanks a lot!
Volker

Subject: How to create the effect of [ ] in "imshow(img,[ ])"

From: ImageAnalyst

Date: 19 May, 2008 16:51:50

Message: 2 of 4

On May 19, 12:22=A0pm, "Volker Klink" <klinkv.NOS...@yahoo.de> wrote:
> Hi all!
>
> I guess this must be very simple but apparently it's too
> complicated for me (or it's too late to be still in the
> lab....).
> I would like to manipulate image data in the same way as
> "imshow" does, when u call it with [ ]. So I want the same
> appearance of the image regardless how i call imshow...
> The MatLAb help says:
>
> 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. If
> you use an empty matrix ([]) for [low high], imshow uses
> [min(I(:)) max(I(:))]; that is, the minimum value in I is
> displayed as black, and the maximum value is displayed as white.
>
> I tried to stretch the histogramm manually so the minimum
> value in would be zero and the maximum value =3D 255 (similar
> to imadjust(I)) does but that doesn't work.
> Anyone has ac lue?
> Thanks a lot!
> Volker

--------------------------------------------------------
Volker:
I don't understand. How could the image of a given, single array look
the same regardless of how you call imshow()? If you pass in
different [low high] values or different colormaps, it WILL look
different. It has to and that is what it is designed to do. The only
way to get the images to look the same, despite different arguments to
imshow(), is to pass it different images.

What doesn't work? You didn't give your code. Basically the output
image would be something like 255*(imageArray - minValue) / (maxValue-
MinValue). Is that what you did?

Regards,
ImageAnalyst

Subject: How to create the effect of [ ] in

From: Volker Klink

Date: 19 May, 2008 17:08:02

Message: 3 of 4

 Basically the output image would be something like
255*(imageArray - minValue) / (maxValue-
> MinValue). Is that what you did?
--> Thats what I did.

Okay, maybe it wasn't clear what I'm trying to do.
I have an image, which looks very different depending on how
I call it. I prefer to call it with imshow(Img,[]) since the
contrast is much better.
I would like to manipulate the image data in a way, that
imshow(ImgNew) produces the same result as
imshow(ImgOriginal,[]).

Thanks
Volker



Subject: How to create the effect of [ ] in

From: ImageAnalyst

Date: 19 May, 2008 17:49:33

Message: 4 of 4

On May 19, 1:08=A0pm, "Volker Klink" <klinkv.NOS...@yahoo.de> wrote:
> =A0Basically the output image would be something like
> 255*(imageArray - minValue) / (maxValue-> MinValue). =A0Is that what you d=
id?
>
> --> Thats what I did.
>
> Okay, maybe it wasn't clear what I'm trying to do.
> I have an image, which looks very different depending on how
> I call it. I prefer to call it with imshow(Img,[]) since the
> contrast is much better.
> I would like to manipulate the image data in a way, that
> imshow(ImgNew) produces the same result as
> imshow(ImgOriginal,[]).
>
> Thanks
> Volker
----------------------------------------------------------------------------=

Volker:
OK, but can you answer EACH of these questions?
1. Why do you care if you call imshow(ImgNew) or imshow(ImgOriginal,
[])? They'll both display the same appearance except that the first
way you'll take more time and use more memory to create this
intermediate image. Since they would both appear the same, why do you
have this preference for the more time-consuming, memory consuming
method?
2. Why didn't imadjust() do what you want? Can you show your code
and point out how you determined that it failed?
3. Did you try the formula I gave in my prior answer? I think that
should work. Let me know why you're not going to try that or, if you
did, any error message or indication that it didn't scale the image
properly.

Regards,
ImageAnalyst

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
imshow Volker Klink 19 May, 2008 12:25:07
histogramm Volker Klink 19 May, 2008 12:25:07
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com