azmiozgen / text-detection Goto Github PK
View Code? Open in Web Editor NEWText detection with mainly MSER and SWT
License: GNU General Public License v3.0
Text detection with mainly MSER and SWT
License: GNU General Public License v3.0
yin@yin-00:~/text-detection-master/text-detection-master$ python3 text_detect.py -i ./images/scenetext01.jpg -f
File "text_detect.py", line 130
def getStrokes(self, (x, y, w, h)):
^
SyntaxError: invalid syntax
yin@yin-00:~/text-detection-master/text-detection-master$ python3 text_detect.py -i ./images/scenetext01.jpg -o ./output
File "text_detect.py", line 130
def getStrokes(self, (x, y, w, h)):
^
SyntaxError: invalid syntax
How should this problem be solved?
In the process of using your code, I encountered a small problem, that is, only a part of the text can be recognized. I guess the recognition threshold needs to be adjusted. Because of the time constraint, I didn't see your code well, so I want to ask you how to adjust the threshold value!
def getStrokes(self, (x, y, w, h)):
^
SyntaxError: invalid syntax
Thanks for sharing. When I run the code, there'is some errors that I have no idea to work out, " File "D:\Program Files\Anaconda3\envs\test_py2\lib\site-packages\pytesseract\pytesseract.py", line 116, in run_tesseract
raise TesseractError(status_code, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, u'Error opening data file ./tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.')"
Would you please tell me something that I need to check out?
非常感谢,尝试了先使用短的代码来实验,还是会报同样的error,实验和error如下:
from PIL import Image
import pytesseract
imageObject=Image.open('test.jpg')
print (imageObject)
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=800x600 at 0x5BE4CF8>
print (pytesseract.image_to_string(imageObject))
Traceback (most recent call last):
File "", line 1, in
File "D:\Program Files\Anaconda3\envs\test_py2\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "D:\Program Files\Anaconda3\envs\test_py2\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "D:\Program Files\Anaconda3\envs\test_py2\lib\site-packages\pytesseract\pytesseract.py", line 116, in run_tesseract
raise TesseractError(status_code, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, u'Error opening data file ./tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.')
Command ran: python detect.py -i input_scenetext01.jpg
Output:
[================================================================] 1524 of 1524
0 regions left.
Traceback (most recent call last):
File "C:\Workspaces\Python\text-detection\src\detect.py", line 41, in
res = td.detect()
File "C:\Workspaces\Python\text-detection\src\lib\text_detection.py", line 280, in detect
for i, (contour, hierarchy) in enumerate(zip(contours, hierarchies[0])):
TypeError: 'NoneType' object is not subscriptable
requirements ( pip freeze ):
contourpy==1.2.0
cycler==0.12.1
fonttools==4.47.0
importlib-resources==6.1.1
kiwisolver==1.4.5
matplotlib==3.8.2
numpy==1.26.3
opencv-python==4.9.0.80
packaging==23.2
pillow==10.2.0
progressbar==2.5
pyparsing==3.1.1
pytesseract==0.3.10
python-dateutil==2.8.2
scipy==1.11.4
six==1.16.0
zipp==3.17.0
I've executed this command python text_detect.py -i images/scenetext01.jpg
, but got this error
Traceback (most recent call last): File "text_detect.py", line 344, in <module> res = td.detect() File "text_detect.py", line 286, in detect image, contours, hierarchies = cv2.findContours(dilated, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) ValueError: not enough values to unpack (expected 3, got 2)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.