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)
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)