<commit_before>import cv2
import numpy as np
import tesseract

api = tesseract.TessBaseAPI()
api.Set

testImage = cv2.imread('someGirl.jpg')

for i in xrange(len(testImage)):
    for j in xrange(len(testImage[i])):
        change = True
        for k in xrange(len(testImage[i][j])):
            if abs(testImage[i][j][k] - 255) > 10:
                change = False
        if change:
            for k in xrange(len(testImage[i][j])):
                testImage[i][j][k] = 0
        else:
            for k in xrange(len(testImage[i][j])):
                testImage[i][j][k] = 255

cv2.imshow("title", testImage)

while True:
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cv2.destroyAllWindows()<commit_msg>Integrated package for OCR from snapchat images<commit_after>import cv2
import numpy as np
import tesseract

testImage = cv2.imread('someGirl.jpg')

for i in xrange(len(testImage)):
    for j in xrange(len(testImage[i])):
        change = True
        for k in xrange(len(testImage[i][j])):
            if abs(testImage[i][j][k] - 255) > 10:
                change = False
        if change:
            for k in xrange(len(testImage[i][j])):
                testImage[i][j][k] = 0
        else:
            for k in xrange(len(testImage[i][j])):
                testImage[i][j][k] = 255

cv2.imshow("title", testImage)

while True:
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cv2.destroyAllWindows()

api = tesseract.TessBaseAPI()
api.Init(".", "eng", tesseract.OEM_DEFAULT)
api.SetPageSegMode(tesseract.PSM_AUTO)

print "Starting to detect!"
tesseract.SetCvImage(testImage, api)
print api.GetUTF8Text()
print
print "Confidence:", api.MeanTextConf()

api.End()
{'fraction_non_alphanumeric': 0.1430260047281324, 'fraction_numerical': 0.01950354609929078, 'mean_word_length': 2.6884531590413943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2724592', 'n_tokens_mistral': 625, 'n_tokens_neox': 602, 'n_words': 137}