2015 python final hw _image detect
- Purpose:USing pytesseractan and OCRsoftware with GUI tkinter to recognize text picture to string.
- Using software: python
- Need to import and installed software
- python3.4
- pytesseract(If run in python27 will have some problem)
- tkinter
- pip os
- PIL
- easygui
- cv2
- numpy
- Context explain:
- Reading file absolute address:
- IF choosen ITEM,convert it as 300*300 and show on carve:
- Use pytesseract to convert img to string
- Transform colored img to black and white image and save it.
- Export to exe:
- downloads py2exe and install
- notice:if run in window the last one should write
- from distutils.core import setup
- import py2exe
- setup(windows=["final.py"]) #final.py is your file name
- setup file:
- exe file:(解壓縮後執行 final.exe)
- python file:
- PPT:PPT
pytesseract source code
https://github.com/madmaze/pytesseract
- PIL image形式:
- <PIL.Image.Image image mode=RGB size=200x60 at 0xC025D0>
- array;
- array([[[255, 191, 219],
- [253, 180, 209],
- [253, 188, 218],
- ...,
- [251, 190, 224],
- [251, 190, 224],
- [253, 189, 224]],
- [[255, 197, 219],
- [249, 195, 218],
- [244, 199, 222],
- ...,
- [250, 190, 224],
- [251, 190, 224],
- [253, 189, 224]],
- [[135, 97, 110],
- [155, 118, 135],
- [154, 123, 141],
- ...,
- [250, 190, 224],
- [250, 190, 224],
- [251, 190, 224]],
- ...,
- [[248, 191, 224],
- [248, 191, 224],
- [248, 191, 224],
- ...,
- [248, 191, 224],
- [248, 191, 224],
- [248, 191, 224]],
- [[248, 191, 224],
- [248, 191, 224],
- [248, 191, 224],
- ...,
- [248, 191, 224],
- [248, 191, 224],
- [248, 191, 224]],
- [[248, 191, 224],
- [248, 191, 224],
- [248, 191, 224],
- ...,
- [248, 191, 224],
- [248, 191, 224],
- [248, 191, 224]]], dtype=uint8)
- reference:
- https://saxenarajat99.wordpress.com/2014/10/04/optical-character-recognition-in-python/
- http://www.apkapps.link/questions/212476/convert-rgb-to-black-or-white
- http://www.pythonforbeginners.com/files/reading-and-writing-files-in-python
- https://www.youtube.com/watch?v=kyoGfnLm4LA
- http://okfnlabs.org/blog/2013/10/17/python-guide-for-file-formats.html
- http://stackoverflow.com/questions/51520/how-to-get-an-absolute-file-path-in-python
- http://stackoverflow.com/questions/18950668/os-path-split-changing-file-name-with-out-compromising-the-path
沒有留言:
張貼留言