[EDA] 데이터 깔끔하게 처리해보기 #41
Sooho-Kim
started this conversation in
Experiment
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
결론
변환
음영처리
dilated_img = cv2.dilate(im, np.ones((7,7), np.uint8))
bg_img = cv2.medianBlur(dilated_img, 21)
diff_img = 255 - cv2.absdiff(im, bg_img)
norm_img = cv2.normalize(diff_img, None, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8UC1)
패딩 추가하기
cv_img2= cv2.copyMakeBorder(norm_img, int(h1*0.1), int(h1*0.1), int(w1*0.1), int(w1*0.1), cv2.BORDER_CONSTANT, value=[0,0,0])
BGR2LAB
cv_img2 = cv2.cvtColor(cv_img2, cv2.COLOR_BGR2LAB)
CLAHE
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(int(h/5),int(w/5)))
l1 = clahe.apply(l)
lab = cv2.merge((l1,a,b))
cont_dst = cv2.cvtColor(lab, cv2.COLOR_LAB2BGR)
cv_img2 = cv2.cvtColor(cont_dst, cv2.COLOR_BGR2GRAY)
Threshold
a= 100
b= 255
_, th3 = cv2.threshold(cv_img2, a, b, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
흑백 반전
cv2.bitwise_not(th3[h3:h1+h3,w3:w1+w3] - gray_im)
예시
Beta Was this translation helpful? Give feedback.
All reactions