Update anti.py

This commit is contained in:
HibiKier 2023-08-17 22:37:50 +08:00 committed by GitHub
parent 6beb421dd0
commit 354643f0f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import numpy as np
from PIL import Image
def pixRandomChange(img):
def pix_random_change(img):
# Image转cv2
img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
img[0, 0, 0] = random.randint(0, 0xfffffff)
@ -14,13 +14,10 @@ def pixRandomChange(img):
return img
def pixRandomChangeFile(path):
def pix_random_change_file(path: str):
# 注意cv2.imread()不支持路径中文
warnings.filterwarnings("ignore", category=Warning)
img = cv2.imread(path)
img[0, 0, 0] = random.randint(0, 0xfffffff)
cv2.imwrite(path, img)
print('finish')
pixRandomChangeFile('./0.jpg')