import numpy as np
import cv2
import imutils
image = cv2.imread("/path/your/image.jpg")
image = imutils.resize(image,width = 400)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("Original", image)
(T, threshInv) = cv2.threshold(gray, 65, 255, cv2.THRESH_BINARY)
cnts = cv2.findContours(threshInv.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
clone = image.copy()
for c in cnts:
(x, y, w, h) = cv2.boundingRect(c)
cv2.rectangle(clone,(x,y),(x+w,y+h),(0,255,0),2)
cv2.imshow("All Contours", clone)
cv2.waitKey(0)