How to use the pytesseract.pytesseract function in pytesseract

To help you get started, we’ve selected a few pytesseract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChintanTrivedi / DeepGamingAI_FIFARL / main.py View on Github external
loaded_model_json = json_file.read()
    json_file.close()
    loaded_model = model_from_json(loaded_model_json)
    # load weights into new model
    loaded_model.load_weights("model_epoch1000/model.h5")
    print("Loaded model from disk")
    loaded_model.compile(loss='mse', optimizer='sgd')
    return loaded_model


# model = baseline_model(grid_size=128, num_actions=4, hidden_size=512)
model = load_model()
# model.summary()

# necessary evil
pt.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'

game = FIFA()
print("game object created")

epoch = 1000  # Number of games played in training, I found the model needs about 4,000 games till it plays well

train_mode = 0

if train_mode == 1:
    # Train the model
    hist = train(game, model, epoch, verbose=1)
    print("Training done")
else:
    # Test the model
    hist = test(game, model, epoch, verbose=1)
github Acamy / pet-chain-buyer / ocr.py View on Github external
def ocr_img(image):
    # win环境
    # tesseract 路径
    pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract'
    # 语言包目录和参数
    tessdata_dir_config = '--tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata" --psm 6'


    # 转化为灰度图
    image = image.convert('L')
    # 把图片变成二值图像
    image = binarizing(image, 190)

    img=depoint(image)
    #img.show()

    result = pytesseract.image_to_string(image, config=tessdata_dir_config)
    return result
github khitk9738 / EyeVis / object_recognition_detection / object_detection_webcam.py View on Github external
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image

arch = 'resnet18'

model_file = 'whole_%s_places365_python36.pth.tar' % arch
if not os.access(model_file, os.W_OK):
    weight_url = 'http://places2.csail.mit.edu/models_places365/' + model_file
    os.system('wget ' + weight_url)



pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract'

from utils import label_map_util


from utils import visualization_utils as vis_util
MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'
MODEL_FILE = MODEL_NAME + '.tar.gz'
DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'

PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'

PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')

NUM_CLASSES = 90
github lukegarbutt / RunescapeBots / Original GE Mercher (old) / GEmercherv2.py View on Github external
#RUN AS ADMINISTRATOR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


import pyautogui
import pytesseract
import cv2
import numpy
import PIL
import os
import random
import time
import pickle
import operator

pytesseract.pytesseract.tesseract_cmd = "C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe"

class item():#simple for now, but in future maybe pull ge limits and items from a website??
	def __init__(self, item, limit, image, image_path):
		self.item = item
		self.limit = limit
		self.image = image
		self.image_path = image_path
		self.available_to_buy = limit

	def set_bought_at(self, price):
		self.bought_at = price

	def set_sold_at(self, price):
		self.sold_at = price

	def set_box_containing_item(self, box_coords):
github mozilla / iris_firefox / iris / api / core / util / core_helper.py View on Github external
which_tesseract = subprocess.Popen('which tesseract', stdout=subprocess.PIPE, shell=True).communicate()[
            0].rstrip()
        path_not_found = False

        if get_os() == 'win':
            win_default_tesseract_path = 'C:\\Program Files (x86)\\Tesseract-OCR'

            if '/c/' in str(which_tesseract):
                win_which_tesseract_path = which_tesseract.replace('/c/', 'C:\\').replace('/', '\\') + '.exe'
            else:
                win_which_tesseract_path = which_tesseract.replace('\\', '\\\\')

            if _check_path(win_default_tesseract_path):
                pytesseract.pytesseract.tesseract_cmd = win_default_tesseract_path + '\\tesseract'
            elif _check_path(win_which_tesseract_path):
                pytesseract.pytesseract.tesseract_cmd = win_which_tesseract_path
            else:
                path_not_found = True

        elif get_os() == 'linux' or get_os() == 'osx':
            if _check_path(which_tesseract):
                pytesseract.pytesseract.tesseract_cmd = which_tesseract
            else:
                path_not_found = True
        else:
            path_not_found = True

        if path_not_found:
            logger.critical('Unable to find Tesseract.')
            logger.critical('Please consult wiki for complete setup instructions.')
            return False
        return True
github nimotli / SmartAssistantArab / VideoDetect.py View on Github external
# import the necessary packages
import pytesseract 
from imutils.video import VideoStream
from imutils.video import FPS
from imutils.object_detection import non_max_suppression
import numpy as np
import argparse
import imutils
import time
import cv2
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

def decode_predictions(scores, geometry):
	# grab the number of rows and columns from the scores volume, then
	# initialize our set of bounding box rectangles and corresponding
	# confidence scores
	(numRows, numCols) = scores.shape[2:4]
	rects = []
	confidences = []
 
	# loop over the number of rows
	for y in range(0, numRows):
		# extract the scores (probabilities), followed by the
		# geometrical data used to derive potential bounding box
		# coordinates that surround text
		scoresData = scores[0, 0, y]
		xData0 = geometry[0, 0, y]