image-seg.py 文件源码

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

项目:cancer_nn 作者: tanmoyopenroot 项目源码 文件源码
def generateMask(img):    
    blured_img = getBlurImage(img)
    hsv, hue, sat, val = getHSVImage(blured_img)
    # binary_img_hsv = binaryIMG(blured_img)

    cv2.namedWindow('hsv', cv2.WINDOW_NORMAL)
    cv2.imshow("hsv", hsv)

    hsv += 35

    cv2.namedWindow('hsv-inc', cv2.WINDOW_NORMAL)
    cv2.imshow("hsv-inc", hsv)

    gray = getBinaryImage(hsv)
    filtered_img = getFilterImage(gray)
    opening_img = getOpeningImage(filtered_img)
    closing_img = getClosingImage(opening_img)

    canny_edge_img = autoCannyEdgeDetection(closing_img)
    contours, contour_img = getContourImage(canny_edge_img) 
    binary_line_img = drawLines(contour_img, contours)
    # convex_img = drawConvexHull(hsv, contours) 
    dilation_img = getDilationImage(binary_line_img)

    cv2.namedWindow('gray', cv2.WINDOW_NORMAL)
    cv2.imshow("gray", gray)       
    cv2.namedWindow('canny-edge', cv2.WINDOW_NORMAL)
    cv2.imshow("canny-edge", canny_edge_img)
    cv2.namedWindow('contour', cv2.WINDOW_NORMAL)
    cv2.imshow("contour", contour_img)    
    cv2.namedWindow('dilation', cv2.WINDOW_NORMAL)
    cv2.imshow("dilation", dilation_img)    
    # cv2.namedWindow('convex', cv2.WINDOW_NORMAL)
    # cv2.imshow("convex", convex_img)  
    cv2.waitKey(0)
    cv2.destroyAllWindows()

    return dilation_img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号