March 2019
Intermediate to advanced
532 pages
13h 2m
English
In the previous examples, we have applied the simple thresholding operation to a custom-made image in order to see how the different parameters work. In this section, we are going to apply cv2.threshold() to a real image. The thresholding_example.py script performs this. We applied the cv2.threshold() function with different thresholding values as follows – 60,70,80,90,100,110,120,130:
ret1, thresh1 = cv2.threshold(gray_image, 60, 255, cv2.THRESH_BINARY)ret2, thresh2 = cv2.threshold(gray_image, 70, 255, cv2.THRESH_BINARY)ret3, thresh3 = cv2.threshold(gray_image, 80, 255, cv2.THRESH_BINARY)ret4, thresh4 = cv2.threshold(gray_image, 90, 255, cv2.THRESH_BINARY)ret5, thresh5 = cv2.threshold(gray_image, ...