`imag = cv2.resize(imag, (512, 512),0,0, cv2.INTER_LINEAR)
img2 = cv2.bitwise_not(imag)
blurred = cv2.pyrMeanShiftFiltering(img2,31,91)
gray = cv2.cvtColor(blurred,cv2.COLOR_BGR2GRAY)
ret, thresh =cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
cnts2 = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
cnts2 = cnts2[0] if imutils.is_cv2() else cnts2[1]`
for c in cntr:
cv2.drawContours(image, c, -1, (0, 255, 0), 2)
cv2.imshow("Screws", image)
cv2.waitKey(0)