Ask Your Question
0

What should be better strategy to extract the curves of this photo

asked 2020-03-02 14:02:41 -0600

raggupta2 gravatar image

How can I extract coutours within this photo?

Running sharpening filters make it worse only

I'm trying to extract counters like this:

cnts = cv2.findContours(gray.copy(), cv2.RETR_EXTERNAL,
                            cv2.CHAIN_APPROX_SIMPLE)

INPUT IMAGE

I've done this sharpening:

image = cv2.imread(file)
    height, width, channels = image.shape

    kernel_sharpen_1 = np.array([[-1, -1, -1], [-1, 9, -1], [-1, -1, -1]])
    kernel_sharpen_2 = np.array([[1, 1, 1], [1, -7, 1], [1, 1, 1]])
    kernel_sharpen_3 = np.array([
        [-1, -1, -1, -1, -1],
        [-1, 2, 2, 2, -1],
        [-1, 2, 8, 2, -1],
        [-1, 2, 2, 2, -1],
        [-1, -1, -1, -1, -1]]) / 8.0

    output_1 = cv2.filter2D(image, -1, kernel_sharpen_1)
    output_2 = cv2.filter2D(image, -1, kernel_sharpen_2)
    output_3 = cv2.filter2D(image, -1, kernel_sharpen_3)

    cv2.imshow('Sharpening', output_1)
    cv2.imshow('Excessive Sharpening', output_2)
    cv2.imshow('Edge Enchancement', output_3)

    cv2.waitKey(0)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-03-02 18:24:27 -0600

lnx gravatar image

directly using findcontours might not give right answer blur(removes noise) -> threshold -> dilate(dilates the white portion) might be the good approach

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-03-02 14:02:41 -0600

Seen: 199 times

Last updated: Mar 02 '20