I want to draw the contour around extracted sclera. (Sclera segmentation was done by using this way).
This is the output, I got after follow the below given code.
This is actual output I want to get.
import numpy as np
from cv2 import cv2
from matplotlib import pyplot as plt
img = cv2.imread('sclera.jpg',1)
gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
cv2.imshow("Adaptive gray Image",gray)
#Contours
contours, hierarchy = cv2.findContours(gray,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
img2 = img.copy()
index = -1 #if negative all contours are drawn, index of contour to be drawn
thickness = 2
color = (5,228,72)
cv2.drawContours(img2,contours,index,color,thickness)
# cv2.imshow('Contours',img2)
for cnt in contours:
area = cv2.contourArea(cnt)
print("Detected Contour with Area: ", area)
cv2.waitKey(0)
cv2.destroyAllWindows()
img3 = cv2.cvtColor(img2,cv2.COLOR_RGB2BGR)
plt.imshow(img3)
Is anybody know why I get the lot of contours in my output? Where could be caused to produce the wrong output?
Any suggestions would appreciate.

