画像のネガポジ反転
2024/11/15
Python3.8.2, OpenCV4.4.0
img_dst = cv2.bitwise_not(img_src)
2値化して反転
import cv2
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.GaussianBlur(img,(5,5),0)
ret,thresh = cv2.threshold(img,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
img_dst = cv2.bitwise_not(thresh)
PythonとOpenCVで画像をネガポジ反転してみた
https://water2litter.net/rum/post/python_cv2_negaposi/