def image():
    import click1
    img_nam = click1.click2()
    destination = "C://Users//Shilpa Bundela//Desktop//ocr//Rachit_GoogleApi_Project//src//" + img_nam
    print(destination)
    l = ocr.detect_text(destination)
    print(l[0])
    for i in l:
        print(i)
    trans = translate.translate_text(l[0])

    return render_template("complete.html", output=l[0], op=trans)
Example #2
0
def multiple_tests(setNum,
                   start,
                   end,
                   ocr="google",
                   requestMethod="multithread",
                   searcher="standard"):
    for i in range(start, end + 1):
        print "***********************************"
        start = time.time()
        filename = 'questions/Set-' + str(setNum) + '/Q' + str(i) + '.png'
        result = detect_text(filename, ocr)
        print process(result, requestMethod, searcher)
        print "Total time: " + str(time.time() - start)
def upload():
    target = os.path.join(APP_ROOT, 'images/')
    print("target =     ", target)

    if not os.path.isdir(target):
        os.mkdir(target)

    for file in request.files.getlist("file"):
        print("file =     ", file)
        filename = file.filename
        destination = "/".join([target, filename])
        print("destination =    ", destination)
        file.save(destination)
    l = ocr.detect_text(destination)
    print(str(l))
    trans = translate.translate_text(
        "HOW TO WRITE ALT TEXT AND IMAGE DESCRIPTIONS FOR THE VISUALLY IMPAIRED"
    )

    return render_template("complete.html", output=l, op=trans)
Example #4
0
from ocr import detect_text
ad = detect_text("t1.jpg")
ad.split("\n")
Example #5
0
import requests
import sys
import content_classification
import ocr
import opencv

if __name__ == "__main__":
    img_data = requests.get(sys.argv[1]).content
    with open('/var/www/html/images/image.jpg', 'wb') as handler:
        handler.write(img_data)
    ocr_image = ocr.analyze_image(
        opencv.do_things("/var/www/html/images/image.jpg"))
    print(
        content_classification.classify(
            ocr.detect_text(ocr.analyze_image(ocr_image))))
    print(ocr.calculate_total(ocr.analyze_image(ocr_image)))
Example #6
0
def single_test(filename,
                ocr="google",
                requestMethod="multithread",
                searcher="standard"):
    result = detect_text(filename, ocr)
    print process(result, requestMethod, searcher)