training.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:retinal-exudates-detection 作者: getsanjeev 项目源码 文件源码
def identify_OD(image):
    newfin = cv2.dilate(image, cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5)), iterations=2)
    mask = np.ones(newfin.shape[:2], dtype="uint8") * 255
    y1, ycontours, yhierarchy = cv2.findContours(newfin.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    prev_contour = ycontours[0]
    for cnt in ycontours:
        if cv2.contourArea(cnt) >= cv2.contourArea(prev_contour):
            prev_contour = cnt
            cv2.drawContours(mask, [cnt], -1, 0, -1)
    M = cv2.moments(prev_contour)
    cx = int(M['m10']/M['m00'])
    cy = int(M['m01']/M['m00']) 
    return (cx,cy)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号