I would like to detect the contour of the giant black blob in the following image:
So I used Canny edge detection to find the edges using the following code:
edged = cv2.Canny(image, 30, 200)
Then, when I try to find the contour, it gives me only half on the blob.
This is the code I used to find the contour:
# find contours in the edged image, keep only the largest
# ones, and initialize our screen contour
(cnts, _) = cv2.findContours(image.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cnts = sorted(cnts, key = cv2.contourArea, reverse = True)[:10]
# Scan the contours for largest item
array_sizes = []
for numpoints in cnts:
array_sizes.append(len(numpoints))
largest = max(array_sizes)
second = second_largest(array_sizes)
index_of_object = array_sizes.index(largest)
# Largest detected contour
screenCnt = cnts[index_of_object]
Is there any alteration I can make in the original image to get a full and more accurate detection of the large black blob? All help is appreciated.