apoorva-dave / LicensePlateDetector

Detects license plate of car and recognizes its characters
349 stars 114 forks source link

LicensePlateDetector-master\SegmentCharacters.py", line 10, in <module> license_plate = np.invert(DetectPlate.plate_like_objects[0]) IndexError: list index out of range #13

Closed cdpavan closed 4 years ago

cdpavan commented 5 years ago

Hi, @apoorva-dave I am trying to detect licence plate number using your code and it is working like a charm for videos but I am facing some issue while detecting number from an image. In DetectPlate.py I am trying to pass the image path in this line car_image =image from my folder But after this, I am getting the following error.

LicensePlateDetector-master\SegmentCharacters.py", line 10, in license_plate = np.invert(DetectPlate.plate_like_objects[0]) IndexError: list index out of range

I tried to rectify by checking other files but no luck yet. Any help would be highly appreciated.

apoorva-dave commented 5 years ago

Hi @cdpavan Did you check the shape of the image loaded? May be it is not getting loaded properly. Try using the image provided in the repo itself. Can you check what is in plate_like_objects while running DetectPlate.py? It might be empty because of which it is throwing list index out of range error. You might be already doing this but just make sure you are commenting the code for reading video in DetectPlate.py. Uncomment the below line and try loading the image. car_image = imread("car.png", as_gray=True)

pavancd1 commented 5 years ago

Hi, @apoorva-dave thank you for your reply. yes plate_like_objects is empty and i am detecting rectangular plates.

yes I commented video part and uncommented image part

apoorva-dave commented 5 years ago

Yes so because no plate is getting detected you are getting this error. You can try running the image from repo. You won't face this issue for that. As I have mentioned the code is not fully robust to handle all images or videos. You might want to improve the code in case you want it to work for all types of images.

cdpavan commented 5 years ago

Thank you for your reply apoorva, can you please tell me where I needs to change the code to detect rectangular plates. Your code is dectecting only square plates ...

apoorva-dave commented 5 years ago

It is detecting square as well as rectangle plates as you can see in readme. Even then If you want to change the dimensions to detect your plate, then you can tweek code in DetectPlate.py where I am getting the maximum and minimum width, height of a license plate (line 59)

sushi-545 commented 4 years ago

hey i think i got the answer comment code for video for image replace this line car_image = imutils.rotate(car_image, 360) ie change rotation to 360 and boom