Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the difference between cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU) and cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY + cv2.THRESH_OTSU)?

Otsu's thresholding

gray = cv2.cvtColor(shifted, cv2.COLOR_BGR2GRAY) thresh = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]

In the end, there's [1] written what does it mean? I am trying to use automatic threshold.

click to hide/show revision 2
No.2 Revision

updated 2017-06-26 05:03:42 -0600

berak gravatar image

cv2 threshold flags

What is the difference between cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU) cv2.THRESH_OTSU) and cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY + cv2.THRESH_OTSU)?

Otsu's thresholding

cv2.THRESH_OTSU) ?

# Otsu's thresholding
gray = cv2.cvtColor(shifted, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]

cv2.THRESH_OTSU)**[1]**

In the end, there's [1] written what does it mean? I am trying to use automatic threshold.