Detecting outer most-edge of image and plotting based on it

后端 未结 6 2109
臣服心动
臣服心动 2020-12-16 07:25

I\'m working on a project that can calculate the angle of an elbow joint by image. The part I\'m struggling on is the image processing.

Currently doing this in Pytho

6条回答
  •  渐次进展
    2020-12-16 07:41

    As you can see, the line in the binary image is not that straight, also there are so many lines similar. So directly doing HoughLine on such an image is a bad choice, not responsibility.


    I try to binary the image , drop the left-top region (3*w/4, h*2/3), then I get the two separate regions:

    img = cv2.imread("img04.jpg", 0)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    th, threshed = cv2.threshold(gray, 100, 255, cv2.THRESH_BINARY_INV|cv2.THRESH_OTSU)
    H,W = img.shape[:2]
    threshed[:H*2//3,:W*3//4] = 0
    
    cv2.imwrite("regions.png", threshed)
    

    Then you can do other post steps as you like.

提交回复
热议问题