-
Notifications
You must be signed in to change notification settings - Fork 1
/
bin_to_img.py
44 lines (43 loc) · 906 Bytes
/
bin_to_img.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
import numpy as np
import cv2
f=open("ofb_dec.txt","r")
a1=0
a2=0
b=0
c=128
z1=0
arr=np.zeros((1024,1024))
lines=f.readline()
print(lines)
#for y in f:
while(lines):
lines = f.readline()
for x in lines:
b=b+c*int(x)
c=c//2
#print("c="+str(c))
if(c==0):
#print(b)
c=128
arr[a1][a2]=b
b=0
print(a1)
z1=z1+1
if(a2==1023):
if(a1==1023):
a1=123456
a1=a1+1
a2=0
#print(a2)
else:
a2=a2+1
#print("hi")
if(z1==8):
z1=0
break
if(a1==123457):
break
image=cv2.imshow("image",arr.astype('uint8'))
#cv2.imwrite("ecb_enc.jpg",image)
cv2.waitKey(0)
cv2.destroyAllWindows()