Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>I</code> is a 2D or 3D matrix (depends on grayscale or color). <code>I(:)</code> is the vector where all values of the matrix are written in a column, just like they are arranged in the memory; you could do by <a href="http://www.mathworks.de/de/help/matlab/ref/reshape.html" rel="nofollow"><code>reshape</code></a> as well. Please read more about the colon-operator in <a href="http://www.mathworks.de/de/help/matlab/ref/colon.html" rel="nofollow">Matlab documentation</a>, it is an absolut basic concept of Matlab.</p> <p><code>max</code> gives you the maximum over a vector, i.e. <code>max(I(:))</code> gives you the maximum value over the whole image.</p> <p>It is an unwritten law that the range of an image starts at 0. Therefore you can map the values of the image to <code>[0,1]</code> by dividing it by <code>max(I(:))</code>. In Matlab it is done like that: <code>myMatrix/myScalar</code>.</p> <p>So <code>I/max(I(:))</code> gives you the image with values in <code>[0,1]</code>, what is required for double-images that you want to show with <code>imshow</code>.</p> <p>Please note:</p> <p>(1) You can write <code>imshow(I,[])</code> instead which will show you the image with values stretched to <code>[0,1]</code> (in difference to your version the minimum is mapped to 0 as well).</p> <p>(2) In my view you should map the values of an image for visualization only in exceptional cases like you do. It can give you wrong impression of the image (e.g. a very dark image will be visualized as full contrast image). Try to devide by maximum of the original value range (often 255, 4095 or 65535). Example:</p> <pre><code>img = imread('some12bit.png'); img = double(img); img = img / 4095; % [0,4095] -&gt; [0,1] imshow(img); </code></pre> <p>(3) Without mapping the image to <code>[0,1]</code> all values <code>&gt; 1</code> will be interpreted as <code>1</code>. That's why your image is shown as a white image without mapping it to <code>[0,1]</code> before.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload