Detecting first inner black circle and making a contour

Dear All,

I am trying to determine the first inner black circle appearing after the solid white. I have tried many ways but have not been able to find a suitable threshold value for this. My code looks like this

guass_kernal = 5
eroded_kernal = (3, 3)
canny_low_limit = 12
canny_up_limit = 20
eroded_iteration = 3

def eroded_image(self, canny_image):
        dilated = cv2.dilate(canny_image, (self.eroded_kernal), iterations=self.eroded_iteration)
        eroded = cv2.erode(dilated, self.eroded_kernal, iterations=self.eroded_iteration)

        thresh = cv2.adaptiveThreshold(eroded, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 3, 2)
        return thresh

image = cv2.imread('image231.jpg', cv2.IMREAD_COLOR)
RGB_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
gray_image = cv2.cvtColor(RGB_image, cv2.COLOR_RGB2GRAY) #gray image

blur_image = cv2.GaussianBlur(gray_image, (guass_kernal, guass_kernal), 5)
canny_image = cv2.Canny(blur_image, canny_low_limit, canny_up_limit, None, 3)
masked_image = eroded_image(canny_image)

contours, heirarchy = cv2.findContours(masked_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(image, contours, -1, (255, 0, 255), 5)

Please help me refine the code and detect the inner circle properly.



i am not getting any answer here. So I have to cross post the question.