johri-lab/Automatic-leaf-infection-identifier

Failed to resize an image

Closed this issue · 6 comments

Image: leaf1.jpg Traceback (most recent call last): File "K:\Tensor\Automatic-leaf-infection-identifier-master\leaf-sampler\leafdetectionALLmix.py", line 79, in <module> img = cv2.resize(img,(275,183)) cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3784: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

This might have occurred when you selected a directory, instead of running the leafdetectionALLmix.py the code on the current directory.
Previously too, the execution of the two leaf sampler codes has shown this type of error. And has always occurred when we run as python3 leafdetectionALLmix.py -i <directory_name>, instead of running it as python3 leafdetectionALLmix.py -i . i.e. for the current directory.
In generally the error is caused when the file or directory is missing.

I am working on the solution to this too. Also, DM me on gitter for any updates over this issue.

you mean i shud just cd to the leaf sampler folder and run LeafdetectionALLmix.py?

Still giving me the same error

`K:\Tensor\Automatic-leaf-infection-identifier\leaf sampler>Python leafdetectionALLmix.py -i K:\Tensor\Automatic-leaf-infection-identifier\testimage


Image Directory : K:\Tensor\Automatic-leaf-infection-identifier\testimage


The code will run for complete folder. Do you really want to continue(Y/N)?y

Processing images...
'clear' is not recognized as an internal or external command,
operable program or batch file.

Progress:||--------------------------------------------------||0.0%Complete
Image: 1.png
Traceback (most recent call last):
File "leafdetectionALLmix.py", line 79, in
img = cv2.resize(img,(275,183))
cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3784: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'`

No run command python3 leafdetectionALLmix.py -i .
Note after -i there is a dot(.) that refers to run the code on the image files in the leaf sampler directory itself.
It won't check for files in sub-directories.
Also, 'clear' is not recognized in windows cmd. You can replace it with 'CLS'

I use Windows OS, in main.py,NameError: name 'ImageFile' is not defined in main.py?

I use Windows OS, in main.py,NameError: name 'ImageFile' is not defined in main.py?

The code is designed to fetch the ImageFile variable directly from the GUI.py module. You can either run it by using the GUI interface, (by running GUI.py) or specify the 'ImageFile' explicitly in the code (refer to other branches in the repo without GUI file).