Demo adshow

Illustrate how to does the adshow function works.

  • The first operation of adshow is to cast the input image type to uint8, including float types. In order to get the correct operation, the user have to check if the input images values can be transformed into uint8 type.
  • adshow correctly display a boolean image, by doing an internal normalization procedure. On the other hand uint8 images with only 0 and 1 values are visualize equally, so uint8 images do not receive any normalization procedure.
  • The same positive data stored under different variable types (uint8,int8,uint16,int16,uint32,int32,uint64,int64,float) are visualized equally.

Function adshow

Synopse

Display images into the web browser.

  • adshow(arr, title='adshow', id=0, slider=None, events=None, status=False)
    • arr: Input numpy_array image to display. Example of accepted types: uint8,int8,uint16,int16,uint32,int32,uint64,int64,float16,float32,float64,bool
    • title: Title of the view window. Default: 'adshow'.
    • id: An identification for the window. Default: 0.

Description

The function adshow is a image visualization tool, it is used to see the images on this wiki and also it could show some description from it.

Observations

  • Boolean data receives an internal normalization procedure before be displayed.
  • Input data receives an uint8 cast procedure before be displayed.
  • Displayed image is uint8 type.
  • The images truncated to uint8 have a similar behaviour as the function mod().

Examples

Example 1

1 from numpy import *
2 
3 lena = adread('lena_color.jpg')
4 adshow(lena, title='Colored Image')
5 lena = adreadgray('lena_color.jpg')
6 adshow(lena, title='Gray Image')
7 print "Image size:", lena.shape
8 print "Min Value from Image: ", min(ravel(lena))
9 print "Max Value from Image: ", max(ravel(lena))
Image size: (512, 512)
Min Value from Image:  5
Max Value from Image:  254

Colored Image

Gray Image

Example 2

The Colour Wheel The basic, twelve-spoke color wheel is an important tool in creating color schemes. The images on the web are restricted to 256 web safe colours (verage amount of computer monitors could reproduce.). The aim is to be confident that the image displayed on a web browser will be a colour closely approximating what it be intended.

1 from numpy import *
2 
3 wheel = adread('colorwheel.jpg')
4 adshow(wheel, title='color wheel')
5 
6 print "Image size:", wheel.shape
7 print "Min Value from Image: ", min(ravel(wheel))
8 print "Max Value from Image: ", max(ravel(wheel))
Image size: (3, 500, 500)
Min Value from Image:  0
Max Value from Image:  255

color wheel

Example 3

Positives values.

Input (uint8) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (uint16) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (uint32) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (uint64) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (int8) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (int16) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (int32) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (int64) :
[[ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]
 [ 0  0  3  3  6  6 10 10]]
Input (float32) :
[[  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]]
Input (float64) :
[[  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]
 [  0.   0.   3.   3.   6.   6.  10.  10.]]

uint8

uint16

uint32

uint64

int8

int16

int32

int64

float32

float64

Example 4

Negatives values.

Input (int8) :
[[-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]]
Input (int16) :
[[-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]]
Input (int32) :
[[-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]]
Input (int64) :
[[-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]
 [-10 -10  -7  -7  -4  -4   0   0]]
Input (float32) :
[[-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]]
Input (float64) :
[[-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]
 [-10. -10.  -7.  -7.  -4.  -4.   0.   0.]]

int8

int16

int32

int64

float32

float64

Equation

  1. Adshow realize a uint8() cast procedure on the input image, in order to obtain only values into [0,255] range.

  2. The only exception is boolean type image that receives a normalization procedure into adshow function.

    with ; ; ; .