femioladeji / License-Plate-Recognition-Nigerian-vehicles

A python program that uses the concept of OCR using machine learning to identify the characters on a Nigerian license plate
https://blog.devcenter.co/developing-a-license-plate-recognition-system-with-machine-learning-in-python-787833569ccd
250 stars 126 forks source link

module 'localization' has no attribute 'binary_car_image' #39

Closed Vishnukvsvk closed 3 years ago

Vishnukvsvk commented 4 years ago

from skimage import measure from skimage.measure import regionprops import matplotlib.pyplot as plt import matplotlib.patches as patches import localization

this gets all the connected regions and groups them together

label_image = measure.label(localization.binary_car_image)

fig, (ax1) = plt.subplots(1) ax1.imshow(localization.gray_car_image, cmap="gray");

regionprops creates a list of properties of all the labelled regions

for region in regionprops(label_image): if region.area < 50:

if the region is so small then it's likely not a license plate

    continue

# the bounding box coordinates
minRow, minCol, maxRow, maxCol = region.bbox
rectBorder = patches.Rectangle((minCol, minRow), maxCol-minCol, maxRow-minRow, edgecolor="red", linewidth=2, fill=False)
ax1.add_patch(rectBorder)
# let's draw a red rectangle over those regions

plt.show()

AttributeError Traceback (most recent call last)

in () 6 7 # this gets all the connected regions and groups them together ----> 8 label_image = measure.label(localization.binary_car_image) 9 10 fig, (ax1) = plt.subplots(1) AttributeError: module 'localization' has no attribute 'binary_car_image'
femioladeji commented 4 years ago

@Vishnukvsvk did you ensure the localization.py file has been run before running this file

JigarJoshi04 commented 4 years ago

just use binary_car_image insted of using localization.binary_car_image

JigarJoshi04 commented 4 years ago

Ensure that you run localization.py file before running this main file

Vishnukvsvk commented 3 years ago

just use binary_car_image insted of using localization.binary_car_image

Thanks. This helped me.