The types of thresholding operation are described according to its formulation. Take into account that src is the source (original) image, and dst corresponds to the destination (result) image after thresholding. In this sense, src(x, y) will correspond to the intensity of the pixel (x, y) of the source image, and dst(x, y) will correspond to the intensity of the pixel (x, y) of the destination image.
Here is the formula for cv2.THRESH_BINARY:
So, if the intensity of the pixel src(x, y) is higher than thresh, then the new pixel intensity is set to a maxval parameter. Otherwise, the pixels are set to 0.
Here is the formula ...