numpy - How are non integer images represented? -


intro

to computer, digital grayscale images represented integer matrices maximim number (which dependent on integer precision) represents black 0 white.

enter image description here

here representation of image integers, , when cast floats.

enter image description here

int array([[6, 1, 1, 0, 6, 4],        [0, 1, 2, 7, 5, 2],        [0, 4, 6, 6, 3, 4],        [1, 1, 2, 6, 7, 0],        [3, 6, 6, 5, 5, 3]])  float array([[ 6.,  1.,  1.,  0.,  6.,  4.],        [ 0.,  1.,  2.,  7.,  5.,  2.],        [ 0.,  4.,  6.,  6.,  3.,  4.],        [ 1.,  1.,  2.,  6.,  7.,  0.],        [ 3.,  6.,  6.,  5.,  5.,  3.]]) 

question

i've been working svd, , result, image matrix representation consists of floats. gets printed fine imshow matplotlib.

how 'brightness value' mapping works when grayscale image values floats?

according http://www.weizmann.ac.il/matlab/toolbox/images/imshow.html

imshow(i,n) displays intensity image n discrete levels of gray. if omit n, imshow uses 256 gray levels on 24-bit displays, or 64 gray levels on other systems.

imshow(i,[low high]) displays grayscale intensity image, specifying data range i. value low (and value less low) displays black, value high (and value greater high) displays white, , values in between display intermediate shades of gray. imshow uses default number of gray levels. if use empty matrix ([]) [low high], imshow uses [min(i(:)) max(i(:))]; minimum value in displays black, , maximum value displays white.

imshow(bw) displays binary image bw. values of 0 display black, , values of 1 display white.

so depends how calling imshow() how interprets image display. if calling empty matrix [low,high] use whatever max , min values in array are.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -