Пример #1
0
 def contours2(img):
     # equalize Y channel hist
     # img = Preprocess.equalizeHistYChannel(img)
     # remove artifacts
     # img = Preprocess.removeArtifact(img)
     # remove RGB artifact
     img = Preprocess.removeArtifactYUV(img)
     # apply OTSU threshold
     ret, thresh = Preprocess.OTSUThreshold(img)
     # search for contours and select the biggest one
     c, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE,
                                               cv2.CHAIN_APPROX_NONE)
     cnt = max(contours, key=cv2.contourArea)
     return cnt