
# Pathon at GlobalSino: https://www.globalsino.com/ICs/page4853.html

# Use thresholding to create a binary image

import cv2
import numpy as np
 
image1 = cv2.imread('ImageTarget.tif')
 
# Convert the image in grayscale
img = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
 
# Set all pixels value of the input image above 130 to 255
ret, thresh = cv2.threshold(img, 130, 255, cv2.THRESH_BINARY)
 
cv2.imshow('Binary Threshold', thresh)
   
# De-allocate any associated memory usage 
if cv2.waitKey(0) & 0xff == 27:
    cv2.destroyAllWindows()
