12345678910111213141516171819202122232425262728293031323334353637383940 |
- import base64
- import io
- import numpy as np
- import cv2
- from PIL import Image
- from utils import base64_decode
- # with open(r"C:\Users\Administrator\Desktop\base64_2.txt", "r") as f:
- # _str = f.read()
- #
- # _str, _str_old = base64_decode(_str, is_test=True)
- # print(len(_str_old)%4)
- #
- # with open(r"C:\Users\Administrator\Desktop\base64_wrong.txt", "w") as f:
- # f.write(_str_old)
- #
- # image_np = cv2.imdecode(np.frombuffer(_str, np.uint8), cv2.IMREAD_COLOR)
- # cv2.imshow("i", image_np)
- # cv2.waitKey(0)
- # with open(r"C:\Users\Administrator\Desktop\2.png", "rb") as f:
- # _str = f.read()
- # _str = base64.b64encode(_str)
- # with open(r"C:\Users\Administrator\Desktop\base64_right.txt", "wb") as f:
- # f.write(_str)
- #
- # _str = base64.b64decode(_str)
- # image_np = cv2.imdecode(np.frombuffer(_str, np.uint8), cv2.IMREAD_COLOR)
- # cv2.imshow("i", image_np)
- # cv2.waitKey(0)
- # with open(r"C:\Users\Administrator\Desktop\2.jpg", "wb") as f:
- # f.write(_str)
- _l = [None, 1, None]
- print(_l.count(None))
|