Function to Clean Text Automatically. It takes the images and converts it to gray scale, we measure the number of white pixels (between 245 - 255) in the bottom of the image. Then we convert the image to blur scale and calculate the lines, if the slope of the lines is between -0.06 and 0.06 we return the values. Finally, we delete that part of the images.
- 1.- We convert the image to grayscale
- 2.- Take the 25% bottom part of the image
- 3.- Count the number of white pixels (white pixels >= 250)
- 4.- If the number of white pixels is more than 90000 we apply this:
- 5.- Convert the image to blurscale
- 6.- Calculate the lines and slope
- 7.- If the slope is between -0.06 and 0.06 return this values
- 8.- If we have slope between -0.06 and 0.06 take the minimum line in y axis.
- 9.- Delete from that point to the end of the picture