MicrocontrollersAndMore / OpenCV_3_License_Plate_Recognition_Python

https://www.youtube.com/watch?v=fJcl6Gw1D8k
525 stars 317 forks source link

issue with kNearest #21

Open abhinav29a opened 4 years ago

abhinav29a commented 4 years ago

The following is the error showing

/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py:42: UserWarning: loadtxt: Empty input file: "classifications.txt"
/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py:50: UserWarning: loadtxt: Empty input file: "flattened_images.txt"

errorTraceback (most recent call last)
<ipython-input-3-d66bbb23e230> in <module>()
    140 ###################################################################################################
    141 if __name__ == "__main__":
--> 142     main()
    143 # end if

<ipython-input-3-d66bbb23e230> in main()
    122         npaROIResized = np.float32(npaROIResized)       # convert from 1d numpy array of ints to 1d numpy array of floats
    123 
--> 124         retval, npaResults, neigh_resp, dists = kNearest.findNearest(npaROIResized, k = 1)     # call KNN function find_nearest
    125 
    126         strCurrentChar = str(chr(int(npaResults[0][0])))                                             # get character from results

error: OpenCV(3.4.3) /io/opencv/modules/ml/src/knearest.cpp:312: error: (-215:Assertion failed) test_samples.type() == CV_32F && test_samples.cols == samples.cols in function 'findNearest'

I dont know what to do can anybody suggest something

joaolcaas commented 4 years ago

I'm facing the same problem here

abhinav29a commented 4 years ago

I am running my code on google colab and this is the error shown Any idea where the issue is ?

joaolcaas commented 4 years ago

I was runnning just the main file at my computer and this error was showing up after some chages that i had done. I was looking for some help in issue page and i found this. Just make this changes after download the repository and the code will work properly.