Function iaisbinary

Synopse

Check for binary image

  • bool = iaisbinary(f)
    • bool: Boolean
    • f: Image
1. from numpy import *
2. 
3. def iaisbinary(f):
4. 
5.   return f.dtype == bool

Description

iaisbinary returns TRUE(1) if the datatype of the input image is binary which is represented by a boolean image in Python (bool). A binary image has just the values 0 and 1.

Examples

Example 1

1. from ia870 import iaisbinary
2. 
3. a = array([0, 1, 0, 1],bool)
4. print iaisbinary(a)
5. 
6. b = array([0, 1, 0, 1], uint8)
7. print iaisbinary(b)
True
False