I am using the following lines of code for ICR
im2,contours,hier =cv2.findContours(thresh.copy(),cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
for cnt in contours:
if (cv2.contourArea(cnt)>50 and cv2.contourArea(cnt)<1000):
[x,y,w,h] = cv2.boundingRect(cnt)
This gives contours within contours. Kindly suggest me how to remove that in python.