반응형 이진화1 [Image Processing][Python]이미지 이진화(Binarization) 이전 포스팅에서 말했던 대로 오늘은 numpy 모듈도 사용해서 구현해보았습니다. 사용한 샘플 사진은 저번 포스팅과 같습니다. 결과 : 코드 : import cv2 import numpy as np def cvt_to_binary(img,binary_threshold): img1 = np.where(img > binary_threshold,255,img) img2 = np.where(img1 < binary_threshold,0,img1) return img2 img_name = input('Input Image Name : ') binary_threshold = int(input('Input Binary Threshold : ')) img = cv2.imread(f'./img_sample/{img_nam.. 2021. 12. 7. 이전 1 다음 반응형