-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowImage.py
More file actions
62 lines (47 loc) · 1.22 KB
/
showImage.py
File metadata and controls
62 lines (47 loc) · 1.22 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from pylab import *
import thread
#our scanning data here
file= open('output.txt', 'r')
text=file.readline()
a=eval(text)
def findMax(matrix):
maxvalue=matrix[0][0]
for row in matrix:
for element in row:
if(element>maxvalue):
maxvalue=element
return maxvalue
def findMin(matrix):
minvalue=matrix[0][0]
for row in matrix:
for element in row:
if(element<minvalue):
minvalue=element
return minvalue
def rotatePic(gridArray):
returnMatrix=[]
for i in range(len(gridArray[0])):
locArray=[]
for j in range(len(gridArray)):
locArray.append(gridArray[j][len(gridArray[0])-i-1])
returnMatrix.append(locArray)
return returnMatrix
def generateScale(matrix):
b=[]
delta=1.0*(findMax(matrix)-findMin(matrix))/100
for i in range(100):
c=i*delta+findMin(matrix)
b.append(c)
B=[]
for j in range(10):
B.append(b)
return B
def showPic(matrix):
imshow(matrix, interpolation='bilinear')
grid(False)
show()
print "minimum value is "+str(findMin(a)*100)
print "maxvalue is "+str(findMax(a)*100)
B=generateScale(a)
showPic(a)
showPic(B)