├── .gitignore ├── Image ├── +.PNG ├── -.PNG ├── 0.PNG ├── 1.PNG ├── 2.PNG ├── 3.PNG ├── 4.PNG ├── 5.PNG ├── 6.PNG ├── 7.PNG ├── 8.PNG ├── 9.PNG ├── a.png ├── b.png ├── c.png ├── ca.png ├── cb.png ├── cc.png ├── cd.png ├── ce.png ├── cf.png ├── cg.png ├── ch.png ├── ci.png ├── cj.png ├── ck.png ├── cl.png ├── cm.png ├── cn.png ├── co.png ├── coma.PNG ├── cp.png ├── cq.png ├── cr.PNG ├── cs.PNG ├── ct.PNG ├── cu.png ├── cv.png ├── cw.png ├── cx.png ├── cy.png ├── cz.png ├── d.png ├── e.png ├── f.png ├── fs.PNG ├── g.png ├── h.png ├── i.png ├── j.png ├── k.png ├── l.png ├── m.png ├── n.png ├── o.png ├── p.png ├── q.png ├── que.PNG ├── r.png ├── s.png ├── t.png ├── u.png ├── v.png ├── w.png ├── x.png ├── y.png ├── z.png ├── zback.png └── zspace.png ├── Programs ├── AutoDownloader.py ├── CodeWithGUI.py ├── ConvertRawText.py └── ScanFromCamera.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /Image/+.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/+.PNG -------------------------------------------------------------------------------- /Image/-.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/-.PNG -------------------------------------------------------------------------------- /Image/0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/0.PNG -------------------------------------------------------------------------------- /Image/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/1.PNG -------------------------------------------------------------------------------- /Image/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/2.PNG -------------------------------------------------------------------------------- /Image/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/3.PNG -------------------------------------------------------------------------------- /Image/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/4.PNG -------------------------------------------------------------------------------- /Image/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/5.PNG -------------------------------------------------------------------------------- /Image/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/6.PNG -------------------------------------------------------------------------------- /Image/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/7.PNG -------------------------------------------------------------------------------- /Image/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/8.PNG -------------------------------------------------------------------------------- /Image/9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/9.PNG -------------------------------------------------------------------------------- /Image/a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/a.png -------------------------------------------------------------------------------- /Image/b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/b.png -------------------------------------------------------------------------------- /Image/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/c.png -------------------------------------------------------------------------------- /Image/ca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ca.png -------------------------------------------------------------------------------- /Image/cb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cb.png -------------------------------------------------------------------------------- /Image/cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cc.png -------------------------------------------------------------------------------- /Image/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cd.png -------------------------------------------------------------------------------- /Image/ce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ce.png -------------------------------------------------------------------------------- /Image/cf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cf.png -------------------------------------------------------------------------------- /Image/cg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cg.png -------------------------------------------------------------------------------- /Image/ch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ch.png -------------------------------------------------------------------------------- /Image/ci.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ci.png -------------------------------------------------------------------------------- /Image/cj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cj.png -------------------------------------------------------------------------------- /Image/ck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ck.png -------------------------------------------------------------------------------- /Image/cl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cl.png -------------------------------------------------------------------------------- /Image/cm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cm.png -------------------------------------------------------------------------------- /Image/cn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cn.png -------------------------------------------------------------------------------- /Image/co.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/co.png -------------------------------------------------------------------------------- /Image/coma.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/coma.PNG -------------------------------------------------------------------------------- /Image/cp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cp.png -------------------------------------------------------------------------------- /Image/cq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cq.png -------------------------------------------------------------------------------- /Image/cr.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cr.PNG -------------------------------------------------------------------------------- /Image/cs.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cs.PNG -------------------------------------------------------------------------------- /Image/ct.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/ct.PNG -------------------------------------------------------------------------------- /Image/cu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cu.png -------------------------------------------------------------------------------- /Image/cv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cv.png -------------------------------------------------------------------------------- /Image/cw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cw.png -------------------------------------------------------------------------------- /Image/cx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cx.png -------------------------------------------------------------------------------- /Image/cy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cy.png -------------------------------------------------------------------------------- /Image/cz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/cz.png -------------------------------------------------------------------------------- /Image/d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/d.png -------------------------------------------------------------------------------- /Image/e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/e.png -------------------------------------------------------------------------------- /Image/f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/f.png -------------------------------------------------------------------------------- /Image/fs.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/fs.PNG -------------------------------------------------------------------------------- /Image/g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/g.png -------------------------------------------------------------------------------- /Image/h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/h.png -------------------------------------------------------------------------------- /Image/i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/i.png -------------------------------------------------------------------------------- /Image/j.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/j.png -------------------------------------------------------------------------------- /Image/k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/k.png -------------------------------------------------------------------------------- /Image/l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/l.png -------------------------------------------------------------------------------- /Image/m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/m.png -------------------------------------------------------------------------------- /Image/n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/n.png -------------------------------------------------------------------------------- /Image/o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/o.png -------------------------------------------------------------------------------- /Image/p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/p.png -------------------------------------------------------------------------------- /Image/q.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/q.png -------------------------------------------------------------------------------- /Image/que.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/que.PNG -------------------------------------------------------------------------------- /Image/r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/r.png -------------------------------------------------------------------------------- /Image/s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/s.png -------------------------------------------------------------------------------- /Image/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/t.png -------------------------------------------------------------------------------- /Image/u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/u.png -------------------------------------------------------------------------------- /Image/v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/v.png -------------------------------------------------------------------------------- /Image/w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/w.png -------------------------------------------------------------------------------- /Image/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/x.png -------------------------------------------------------------------------------- /Image/y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/y.png -------------------------------------------------------------------------------- /Image/z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/z.png -------------------------------------------------------------------------------- /Image/zback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/zback.png -------------------------------------------------------------------------------- /Image/zspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/ce7014a0a3e198f25fa0d3464b95ce9319cc6bea/Image/zspace.png -------------------------------------------------------------------------------- /Programs/AutoDownloader.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import urllib.request 4 | import string 5 | import time 6 | 7 | arr = string.ascii_lowercase 8 | arr = string.ascii_letters 9 | arr = arr + string.digits + "+,.-? " 10 | 11 | def down(char): 12 | url = "https://raw.githubusercontent.com/Ankit404butfound/HomeworkMachine/master/Image/%s"%char 13 | imglink=urllib.request.urlopen(url) 14 | imgNp=np.array(bytearray(imglink.read())) 15 | img = cv2.imdecode(imgNp,-1) 16 | cv2.imwrite(r"%s"%char,img) 17 | print(char+" saved") 18 | print(arr) 19 | for letter in arr: 20 | if letter == " ": 21 | letter = "zspace" 22 | if letter.isupper(): 23 | letter = "c"+letter.lower() 24 | if letter == ",": 25 | letter = "coma" 26 | if letter == ".": 27 | letter = "fs" 28 | if letter == "?": 29 | letter = "que" 30 | try: 31 | down(letter+".png") 32 | except: 33 | down(letter+".PNG") 34 | print("Handled") 35 | time.sleep(1) 36 | down("zback.png") 37 | 38 | -------------------------------------------------------------------------------- /Programs/CodeWithGUI.py: -------------------------------------------------------------------------------- 1 | import pytesseract 2 | import tkinter as tk 3 | import numpy as np 4 | import urllib.request 5 | import keyboard as key 6 | from PIL import Image 7 | import string 8 | import os 9 | import time 10 | 11 | width = 50 12 | height = 0 13 | newwidth = 0 14 | switch = True 15 | pytesseract.pytesseract.tesseract_cmd = r'C:/Users/pc/Desktop/tess/tesseract.exe' 16 | try: 17 | back = Image.open("zback.png") 18 | except: 19 | print("Image not found, download AutoImgDownloader.py file and run it.") 20 | time.sleep(5) 21 | exit() 22 | 23 | width,height = 50,0 24 | arr = string.ascii_letters 25 | arr = arr + string.digits + "+,.-? " 26 | print(arr) 27 | 28 | def setvar(var,color="black"): 29 | strvar.set(var) 30 | tk.Label(win, textvariable= strvar,fg=color).grid(row=2,column=1) 31 | 32 | def casecheck(case): 33 | global width,height,back 34 | print(width,height) 35 | cases = Image.open("%s.png"%case) 36 | back.paste(cases,(width,height)) 37 | newwidth = cases.width 38 | width = width + newwidth 39 | 40 | def end(): 41 | file = open("zanotherankit.txt","w") 42 | file.write("exit") 43 | file.close() 44 | win.quit() 45 | 46 | def condition(cont): 47 | global arr,width,height,newwidth,back 48 | for letter in cont: 49 | if letter in arr: 50 | if letter == " ": 51 | letter = "zspace" 52 | if letter.isupper(): 53 | letter = "c"+letter.lower() 54 | if letter == ",": 55 | letter = "coma" 56 | if letter == ".": 57 | letter = "fs" 58 | if letter == "?": 59 | letter = "que" 60 | if width + 150 >= back.width: 61 | height = height + 227 62 | width = 50 63 | print(width,height,newwidth) 64 | casecheck(letter) 65 | width,height = 50,0 66 | back.show() 67 | back.close() 68 | back = Image.open("zback.png") 69 | 70 | def scnlivecamera(): 71 | setvar("Please Wait!") 72 | condn = True 73 | os.startfile("zlivecamerafile.py") 74 | while condn: 75 | file = open("zanotherankit.txt") 76 | cont = file.read() 77 | if cont == "working": 78 | setvar("DONE!","green") 79 | condn = False 80 | 81 | def extract(): 82 | setvar("Please Wait!") 83 | win.update() 84 | try: 85 | check = var.get() 86 | imgpath = str(e1.get()) 87 | filepath = str(e2.get()) 88 | 89 | if check: 90 | case = "w" 91 | 92 | else: 93 | case = "a" 94 | 95 | content = pytesseract.image_to_string(Image.open(r'%s'%imgpath)) 96 | 97 | file = open(filepath,case) 98 | file.write(content) 99 | file.write("\n-------------------------------------\n") 100 | file.close() 101 | 102 | print(content) 103 | 104 | setvar("DONE!","green") 105 | condition(content) 106 | 107 | except Exception as e: 108 | setvar("ERROR!","red") 109 | print(e) 110 | 111 | win = tk.Tk() 112 | win.geometry("290x95") 113 | win.title("TxtFromImg") 114 | 115 | strvar = tk.StringVar() 116 | var = tk.IntVar(win) 117 | 118 | tk.Label(win, text="Path to Image : ").grid(row=0) 119 | tk.Label(win, text="Destination folder : ").grid(row=1) 120 | 121 | e1 = tk.Entry(win) 122 | e2 = tk.Entry(win) 123 | e2.insert(0,"zankit.txt") 124 | e1.grid(row = 0,column = 1) 125 | e2.grid(row = 1,column = 1) 126 | 127 | che = tk.Checkbutton(win,text="Delete last saved texts",variable=var).grid(row=2,column=0) 128 | but1 = tk.Button(win,text="Extract",command = extract) 129 | but2 = tk.Button(win,text="Scan",command = scnlivecamera,padx=8) 130 | but3 = tk.Button(win,text="Cancel",command = end) 131 | but1.place(x=30,y=67) 132 | but2.place(x=115,y=67) 133 | but3.place(x=200,y=67) 134 | try : 135 | file = open("zlivecamerafile.py") 136 | file2 = open("zanotherankit.txt") 137 | cont = file2.read() 138 | print(cont) 139 | if cont == "error": 140 | setvar("Prgm was forcefully closed!","orange") 141 | file2.close() 142 | except: 143 | file = open("zlivecamerafile.py","w") 144 | file.write("""import pytesseract 145 | import cv2 146 | import numpy as np 147 | import urllib.request 148 | import keyboard as key 149 | from PIL import Image 150 | import string 151 | import time 152 | ip_add = "192.168.xy.yz:8080" ###Enter your ip address here### 153 | switch = True 154 | file = open("zanotherankit.txt","w") 155 | file.write("working") 156 | file.close() 157 | pytesseract.pytesseract.tesseract_cmd = r'C:/Users/pc/Desktop/tess/tesseract.exe' 158 | url="http://"+ip_add+"/shot.jpg" 159 | scaling_factor =0.3 160 | width,height = 50,0 161 | arr = string.ascii_letters 162 | arr = arr + string.digits + "+,.-? " 163 | print(arr) 164 | def casecheck(case): 165 | global width,height 166 | print(case) 167 | cases = Image.open("%s.png"%case) 168 | back.paste(cases,(width,height)) 169 | newwidth = cases.width 170 | width = width + newwidth 171 | if width + 150 >= back.width: 172 | height = height + 227 173 | width = 50 174 | def condition(cont): 175 | global arr 176 | string = cont.split() 177 | const = " " 178 | cont = const.join(string) 179 | width = 50 180 | height = 0 181 | newwidth = 0 182 | for letter in cont: 183 | if letter in arr: 184 | if letter == " ": 185 | letter = "zspace" 186 | if letter == " ": 187 | letter = "zspace" 188 | if letter.isupper(): 189 | letter = "c"+letter.lower() 190 | if letter == ",": 191 | letter = "coma" 192 | if letter == ".": 193 | letter = "fs" 194 | if letter == "?": 195 | letter = "que" 196 | casecheck(letter) 197 | back.show() 198 | back.close() 199 | return width,height,newwidth 200 | while switch: 201 | file = open("zanotherankit.txt","r") 202 | switch = file.read() 203 | if switch == "exit": 204 | switch = False 205 | 206 | try: 207 | imglink=urllib.request.urlopen(url) 208 | imgNp=np.array(bytearray(imglink.read())) 209 | img = cv2.imdecode(imgNp,-1) 210 | frame = cv2.resize(img, None,fx=scaling_factor,fy=scaling_factor,interpolation=cv2.INTER_AREA) 211 | cv2.imshow('IFT', frame) 212 | cv2.waitKey(1) 213 | if key.is_pressed("r"): 214 | back = Image.open("zback.png") 215 | width = 50 216 | height = 0 217 | newwidth = 0 218 | path = r"zankit.png" 219 | cv2.imwrite(path,img) 220 | content = pytesseract.image_to_string(Image.open(r'%s'%path)) 221 | condition(content) 222 | cv2.waitKey(1) & 0xFF 223 | except: 224 | file = open("zanotherankit.txt","w") 225 | file.write("error") 226 | file.close() 227 | switch = False 228 | print('''ERROR! 229 | To use this feature, you need to download IP webcam from playstore and start server, then open "zlivecamerafile.py" and add your ip address there. 230 | IGNORE IF YOU ALREADY DID.''') 231 | time.sleep(10)""") 232 | 233 | file.close() 234 | file = open("zanotherankit.txt","w") 235 | file.write("exit") 236 | file.close() 237 | win.mainloop() 238 | -------------------------------------------------------------------------------- /Programs/ConvertRawText.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | import string 3 | 4 | back = Image.open("zback.png") 5 | width,height = 50,0 6 | arr = string.ascii_lowercase 7 | arr = arr+" " 8 | 9 | def condn(case): 10 | global width,height 11 | print(case) 12 | cases = Image.open("%s.png"%case) 13 | back.paste(cases,(width,height)) 14 | newwidth = cases.width 15 | width = width+newwidth 16 | 17 | inp = input() 18 | 19 | for letter in inp: 20 | if letter in arr: 21 | if letter == " ": 22 | letter = "zzback" 23 | condn(letter) 24 | 25 | back.show() 26 | -------------------------------------------------------------------------------- /Programs/ScanFromCamera.py: -------------------------------------------------------------------------------- 1 | import pytesseract 2 | import cv2 3 | import numpy as np 4 | import urllib.request 5 | import keyboard as key 6 | from PIL import Image 7 | import string 8 | import time 9 | 10 | ip_add = "192.168.xy.yz:8080" ###Enter your ip address here### 11 | switch = True 12 | 13 | pytesseract.pytesseract.tesseract_cmd = r'C:/Users/pc/Desktop/tess/tesseract.exe' 14 | url="http://"+ip_add+"/shot.jpg" 15 | scaling_factor =0.3 16 | width,height = 50,0 17 | arr = string.ascii_lowercase 18 | arr = arr+" " 19 | 20 | def casecheck(case): 21 | global width,height 22 | print(case) 23 | cases = Image.open("%s.png"%case) 24 | back.paste(cases,(width,height)) 25 | newwidth = cases.width 26 | width = width + newwidth 27 | if width + 150 >= back.width: 28 | height = height + 227 29 | width = 50 30 | 31 | def condition(cont): 32 | global arr 33 | string = cont.split() 34 | const = " " 35 | cont = const.join(string) 36 | width = 50 37 | height = 0 38 | newwidth = 0 39 | for letter in cont: 40 | if letter in arr: 41 | if letter == " ": 42 | letter = "zspace" 43 | 44 | casecheck(letter) 45 | back.show() 46 | back.close() 47 | return width,height,newwidth 48 | while True: 49 | try: 50 | imglink=urllib.request.urlopen(url) 51 | imgNp=np.array(bytearray(imglink.read())) 52 | img = cv2.imdecode(imgNp,-1) 53 | frame = cv2.resize(img, None,fx=scaling_factor,fy=scaling_factor,interpolation=cv2.INTER_AREA) 54 | cv2.imshow('IFT', frame) 55 | cv2.waitKey(1) 56 | if key.is_pressed("r"): 57 | back = Image.open("zback.png") 58 | width = 50 59 | height = 0 60 | newwidth = 0 61 | path = r"zankit.png" 62 | cv2.imwrite(path,img) 63 | content = pytesseract.image_to_string(Image.open(r'%s'%path)) 64 | condition(content) 65 | cv2.waitKey(1) & 0xFF 66 | except Exception as e: 67 | print(e) 68 | print('''ERROR!\nTo use this feature, you need to download IP webcam from playstore and start server, then open "zlivecamerafile.py" and add your ip address there. 69 | IGNORE IF YOU ALREADY DID.''') 70 | time.sleep(10) 71 | break 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HomeworkMachine 2 | This project is capable of converting computer characters to hand-written characters, you need to install pytesserect exe as well as the library. 3 | Copy the "CodeWithGUI.py" and "AutoDownloader.py" file in same folder on the desktop and run, all the images will be automatically downloaded in the same folder. 4 | 5 | **Install instructions :** 6 | 7 | Add Python IDLE to your path, if you are already aware of PIP then you can skip this step.To do that, download the latest version of IDLE and…\ 8 | ![Python setup](https://qphs.fs.quoracdn.net/main-qimg-00614a62293ad3dca4a92503ed4f5caa) 9 | 10 | Now, open cmd or Command Prompt on your computer and type - pip, if everything is find, you should see something like this\ 11 | ![Command prompt](https://qphs.fs.quoracdn.net/main-qimg-aebda86ffaa2611323c3f61e9b2b87cf) 12 | 13 | Now type `pip install numpy` press enter 14 | After it’s installed, type `pip install keyboard` 15 | and after it’s installed, type `pip install Pillow` 16 | and do the same for cv2 library. 17 | 18 | After all the libraries are installed, open this [link](https://github.com/UB-Mannheim/tesseract/wiki) 19 | and download 32bit or 64bit installer of tesseract-ocr, the page should look something like this\ 20 | ![This is image not text](https://qphs.fs.quoracdn.net/main-qimg-c84fb522047f2d1b12f73e5d99ba50ba) 21 | 22 | Just click next a few times and it’s installed, now open the place where it’s and search for an exe file there named teserract, something like this and **copy it’s path somewhere, we will need it later. (Remember this step)**\ 23 | ![tessseract is installed](https://qphs.fs.quoracdn.net/main-qimg-baa69bf667ace72b4168ce2a4764bb8c) 24 | 25 | Now open the [source code of the project](https://github.com/Ankit404butfound/HomeworkMachine) 26 | and open the folder named “Programs” and download these two programs\ 27 | ![Source code programs](https://qphs.fs.quoracdn.net/main-qimg-168da4e13e676f5ec2b02c622a23fe2a) 28 | 29 | Now after they are downloaded, create a folder on Desktop and save both files in that folder\ 30 | ![desktop 1](https://qphs.fs.quoracdn.net/main-qimg-c2c38726960f3c6da0811aee95b2861d)\ 31 | ![desktop 2](https://qphs.fs.quoracdn.net/main-qimg-b37bbb223249b47ad994b7db2a900e6f) 32 | 33 | Now, double click on AutoDownloader file and if all libraries are correctly installed, the code will download all images in the same folder\ 34 | ![first time open](https://qphs.fs.quoracdn.net/main-qimg-772154e701e08706e1a3b3291070c7dd) 35 | 36 | Meanwhile, open the CodeWithGUI file with IDLE to view it’s source code and you will see a line like this\ 37 | ![img1](https://qphs.fs.quoracdn.net/main-qimg-437645103aa902c28cea753353a0c1de)\ 38 | ![img2](https://qphs.fs.quoracdn.net/main-qimg-fa636461eef8e851406b3f4aadaa1a41) 39 | 40 | You’d need to edit that line, so this is where we need the path of that exe file I told you about earlier\ 41 | ![path i told earlier](https://qphs.fs.quoracdn.net/main-qimg-baa69bf667ace72b4168ce2a4764bb8c) 42 | 43 | After you copied the file’s path, open that source code and replace this part of the line with the path of your own exe file\ 44 | ![path of exe file](https://qphs.fs.quoracdn.net/main-qimg-8fb20c483fec85ac52549c6c4fd996de) 45 | 46 | DO NOT TOUCH ANYTHING ELSE, not even those quotations, message me before moving on if you want. 47 | 48 | Now save the changes you have made and close it. Now again open cmd or command prompt ant type pip install pytesseract. After it’s installed goto that folder. 49 | 50 | Now run CodeWithGUI and you should see this if everything works fine\ 51 | ![check if everything is fine](https://qphs.fs.quoracdn.net/main-qimg-56fdba17cd8d2a21683d448a708a0802) 52 | 53 | Now move the image from which you want to read texts from, in the same folder and input it’s name in the entry field and press extract. It will take some time to convert.\ 54 | ![now move the image](https://qphs.fs.quoracdn.net/main-qimg-b51643e3d8d6f02a875fb130d761a2b1) 55 | 56 | The output should look like this, however that capital letters will not be there as I am working on it. 57 | 58 | Now, if you want to use the scan feature, press on the button and it will tell you what to do. 59 | --------------------------------------------------------------------------------