-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_find_last_pixel.py
46 lines (36 loc) · 1.11 KB
/
plot_find_last_pixel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# plot_find_last_pixel.py
#
# (c) 2010 Konstantin Sering, Nora Umbach, Dominik Wabersich
# <colorlab[at]psycho.uni-tuebingen.de>
#
# GPL 3.0+ or (cc) by-sa (http://creativecommons.org/licenses/by-sa/3.0/)
#
# content:
#
# input: --
# output: --
#
# created 2012-02-07 KS
# last mod 2012-02-07 KS
import numpy as np
import pylab
red = range(0, 256)
green = np.repeat(0, 256)
blue = np.repeat(0, 256)
alpha = np.repeat(255, 256)
colors = [(red[i], green[i], blue[i], alpha[i]) for i in range(len(red))]
image_red_top = np.repeat(np.array(colors, dtype=np.uint8, ndmin=3), 128, 0)
image_red = list()
for bit in (1, 2, 4, 8, 16, 32, 64, 128):
blue = np.repeat(bit, 256)
colors = [(red[i], green[i], blue[i], alpha[i]) for i in range(len(red))]
image_red_bot = np.repeat(np.array(colors, dtype=np.uint8, ndmin=3), 128, 0)
image_red.append( np.concatenate( (image_red_top, image_red_bot) ) )
pylab.figure(len(image_red), figsize=(5*len(image_red), 5))
pylab.clf()
for i in range(len(image_red)):
pylab.subplot(1, 8, i)
pylab.imshow(image_red[i])
pylab.show()