machinevisiontoolbox.Image.String
- classmethod Image.String(s)
Create a small image from text string
- Parameters:
s (str) – text string
- Returns:
image
- Return type:
Image
Creates a new image initialized to a compact representation given by a string. Each pixel is a single character in the range 0 to 9, and image rows are separated by a pipe. There are no spaces. All rows must be the same length.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.String('01234|56789|87654') >>> img.print() 0 1 2 3 4 5 6 7 8 9 8 7 6 5 4
- Note:
Pixel values are determined by the unicode value of the character relative to unicode for ‘0’, so other ASCII characters (apart from pipe) can be used to obtain pixel values greater than 9. ‘Z’ is 90 and ‘z’ is 122.
- Seealso: