First, some function: ret, dst = cv2.threshold (src, thresh, maxval, type) of each parameter meaning
src: enter, only single-channel image input, general grayscale image
thresh: Threshold
maxval: When the pixel value exceeds the threshold or smaller than the threshold value, the pixel value to be assigned according to the determined type
type
meaning
cv2.THRESH_BINARY
Takes part exceeding the threshold value MAXVAL (maximum value), and 0 otherwise
cv2.THRESH_BINARY_INV
THRESH_BINARY reversal
cv2.THRESH_TRUNC
Section greater than the threshold set threshold, otherwise unchanged
cv2.THRESH_TOZERO
Greater than the threshold section does not change, otherwise set to 0
cv2.THRESH_TOZERO_INV
THRESH_TOZERO reversal
dst: Output FIG.
ret: Threshold The following specifically about how to use it for the effect of the image after threshold processing and a processing example by a look