my goal is to pre-process image (extracted from a video) for OCR detection. Text is always black, like this example: 
I tried to use age framering and HVS mask:
cv2.accumulateWeighted(frame,avg2,0.005) #res2 = cv2.convertScaleAbs(avg2) # Convert BGR to HSV hsv = cv2.cvtColor(imgray, cv2.COLOR_BGR2HSV) # define range of black color in HSV lower_val = np.array([0,0,0]) upper_val = np.array([179,255,127]) # Threshold the HSV image to get only black colors mask = cv2.inRange(hsv, lower_val, upper_val) # invert mask to get black symbols on white background mask_inv = cv2.bitwise_not(mask) cv2.imshow("Mask", mask) But result are not good enought. Looking for some possible workaroud. Thx