@@ -90,7 +90,7 @@ def open_img():
90
90
def en_fun ():
91
91
global x , image_encrypted , key
92
92
# print(x)
93
- image_input = imread (x , IMREAD_GRAYSCALE )# 'C:/Users/aakas/Documents/flower.jpg'
93
+ image_input = cv2 . imread (x , 0 )# 'C:/Users/aakas/Documents/flower.jpg'
94
94
(x1 , y ) = image_input .shape
95
95
image_input = image_input .astype (float ) / 255.0
96
96
# print(image_input)
@@ -99,7 +99,7 @@ def en_fun():
99
99
key = np .random .normal (mu , sigma , (x1 , y )) + np .finfo (float ).eps
100
100
# print(key)
101
101
image_encrypted = image_input / key
102
- imwrite ('image_encrypted.jpg' , image_encrypted * 255 )
102
+ cv2 . imwrite ('image_encrypted.jpg' , image_encrypted * 255 )
103
103
104
104
imge = Image .open ('image_encrypted.jpg' )
105
105
imge = ImageTk .PhotoImage (imge )
@@ -112,7 +112,7 @@ def de_fun():
112
112
global image_encrypted , key
113
113
image_output = image_encrypted * key
114
114
image_output *= 255.0
115
- imwrite ('image_output.jpg' , image_output )
115
+ cv2 . imwrite ('image_output.jpg' , image_output )
116
116
117
117
imgd = Image .open ('image_output.jpg' )
118
118
imgd = ImageTk .PhotoImage (imgd )
0 commit comments