Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #16

Open
olfaa opened this issue Apr 23, 2018 · 4 comments
Open

Error #16

olfaa opened this issue Apr 23, 2018 · 4 comments

Comments

@olfaa
Copy link

olfaa commented Apr 23, 2018

当我执行此代码时会显示错误消息,请有人可以帮助我
when I execute this code an error message is displayed, please someone can help me
capture du 2018-04-23 13-38-10

@wushilian
Copy link
Owner

@olfaa 图片有问题

@olfaa
Copy link
Author

olfaa commented Apr 23, 2018

OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /io/opencv/modules/imgproc/src/resize.cpp, line 4044
Traceback (most recent call last):
File "train.py", line 25, in
img,label=cfg.read_data(cfg.train_dir)
File "/home/olfa/Bureau/Projet OCR/CRNN_Attention_OCR_Chinese-master/config.py", line 67, in read_data
img = cv2.resize(im, (IMAGE_WIDTH,IMAGE_HEIGHT))
cv2.error: /io/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

@yourlovedu
Copy link

@olfaa 这个是opencv读取图片返回None的问题,将读取图片的代码
im = cv2.imread(image_name, 0) # /255.#read the gray image
替换为
im = cv2.imdecode(np.fromfile(image_name,dtype=np.uint8),-1)
im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
if im is None:
continue
就可以了

@MatrixPlayer
Copy link

im = cv2.imdecode(np.fromfile(image_name,dtype=np.uint8),0) will be ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants