You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
import numpy as np
|
|
import cv2
|
|
def ImgeFix(img):
|
|
# 图像转换为灰度图像
|
|
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
# 灰度二值化
|
|
_, mask = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 100, 255, cv2.THRESH_BINARY_INV)
|
|
dst = cv2.inpaint(img, mask, 10, cv2.INPAINT_NS) # 3:领域大小
|
|
return dst |