Commit a2870472 authored by Diliru Chamika's avatar Diliru Chamika

Delete test.py

parent 48a0eb66
from PIL import Image
import pytesseract
import cv2
import os
pytesseract.pytesseract.tesseract_cmd='C://Program Files/Tesseract-OCR/tesseract.exe'
image = cv2.imread('reports/1.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray,140, 255,cv2.THRESH_BINARY)[1]
#thresh = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
text = pytesseract.image_to_string(thresh)
print(text)
print('========================================')
import re
numbers=re.findall(r"[-+]?\d*\.\d+|\d+",text)
print(numbers)
# show the output images
cv2.imshow("Image", image)
cv2.imshow("gray", gray)
cv2.imshow("Output", thresh)
cv2.waitKey(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment