Smoothing Edges of a Binary Image

前端 未结 5 1004
无人共我
无人共我 2020-12-23 22:32

How to smooth the edges of this binary image of blood vessels obtained after thresholding.

I tried a method somewhat similar to this method but did not qui

5条回答
  •  时光取名叫无心
    2020-12-23 23:09

    You can dilate then erode the areas http://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html.

    import cv2
    import numpy as np
    blur=((3,3),1)
    erode_=(5,5)
    dilate_=(3, 3)
    cv2.imwrite('imgBool_erode_dilated_blured.png',cv2.dilate(cv2.erode(cv2.GaussianBlur(cv2.imread('so-br-in.png',0)/255, blur[0], blur[1]), np.ones(erode_)), np.ones(dilate_))*255)  
    

    EDIT whith a scale facor off 4 before the stuff

提交回复
热议问题