title: OpenCV :Text Processing and Noise Removal
body: <p>I would like to remove the background of an image that contains text to make it text on white background.</p>
  
  <p>sample of image <br><a href="https://i.stack.imgur.com/vRUvS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vRUvS.png" alt="enter image description here"></a></p>
  
  <p>I have tried till now to get HSV of an image and upper and lower boundaries but I can't find upper and lower boundaries that can remove all the background effect</p>
  
  <p>Code used till now :</p>
  
  <pre><code>import cv2
  import numpy as np
  
  
  # Take each frame
  filename = 'img2.png'
  
  img = cv2.imread(filename, 1)
  
  # Convert BGR to HSV
  hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
  # define range of blue color in HSV
  lower_blue = np.array([110,50,50])
  upper_blue = np.array([130,255,255])
  # Threshold the HSV image to get only blue colors
  image_final = cv2.inRange(hsv, lower_blue, upper_blue)
  # Bitwise-AND mask and original image
  res = cv2.bitwise_and(img,img, mask= mask)
  cv2.imshow('frame',img)
  cv2.imwrite('mask.png',image_final)
  
  
  cv2.waitKey(0)
  </code></pre>
  
  <p>Is there a better way to it or do I have to combine multiple lower and upper boundaries to reach my goal?</p>