Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
def to_bin(data):
|
3 |
"""Convert `data` to binary format as string"""
|
4 |
if isinstance(data, str):
|
@@ -35,9 +35,8 @@ def decode(image_name,txt=None):
|
|
35 |
|
36 |
def encode(image_name, secret_data,txt=None):
|
37 |
msg=""
|
38 |
-
|
39 |
-
|
40 |
-
image = Image.open(image_name)
|
41 |
n_bytes = image.shape[0] * image.shape[1] * 3 // 8
|
42 |
print("[*] Maximum bytes to encode:", n_bytes)
|
43 |
secret_data1=secret_data
|
|
|
1 |
+
import cv2
|
2 |
def to_bin(data):
|
3 |
"""Convert `data` to binary format as string"""
|
4 |
if isinstance(data, str):
|
|
|
35 |
|
36 |
def encode(image_name, secret_data,txt=None):
|
37 |
msg=""
|
38 |
+
BGRimage = cv2.imread(image_name)
|
39 |
+
image = cv2.cvtColor(BGRimage, cv2.COLOR_BGR2RGB)
|
|
|
40 |
n_bytes = image.shape[0] * image.shape[1] * 3 // 8
|
41 |
print("[*] Maximum bytes to encode:", n_bytes)
|
42 |
secret_data1=secret_data
|