I have been trying to detect the checkboxes. Though I was able to detect the square contours in other images I was not able to get the contours for this particular image. Please help me detect the checkboxes.

Input image:
[![Input Image](https://i.stack.imgur.com/fnEzB.jpg)](https://i.stack.imgur.com/fnEzB.jpg)

This is my code,

```
for myfile in files:
    image=cv2.imread(myfile)
    image = cv2.resize(image, (180,60), interpolation = cv2.INTER_AREA)
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    #apply otsu's threshold
    thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
        #setting up threshold values
    threshold_max_area = 300
    threshold_min_area = 10
 #finding contours in the image
    cnts = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
    cnts = cnts[0] if len(cnts) == 2 else cnts[1]
#getting the coordinates for each checkbox
    count=0
    centers=[]
    for c in cnts:
        peri = cv2.arcLength(c, True)
        approx = cv2.approxPolyDP(c, 0.035 * peri, True)
        x,y,w,h = cv2.boundingRect(approx)
        aspect_ratio = w / float(h)
        area = cv2.contourArea(c) 
        if len(approx) == 4 and area < threshold_max_area and area > threshold_min_area and (aspect_ratio >= 0.9 and aspect_ratio <= 1.1):
            centers.append([x,y,x+w,y+h]) 
        count=count+1
    print(centers)

cv2.imshow(" ",image)
cv2.waitKey()

```