License plate recognition using OpenCV

痴心易碎 提交于 2020-01-01 02:44:12

问题


I have a project where I need to identify the license plate of a car using OpenCV.

I want to load an image of a number or a letter and let OpenCV identify it and print it to the console.

Is there a function do this? If not, how can I do it?

Note: I am working on gray level

Please help, I have to make it a week from now


thank you for your fast answer

I am working with Microsoft Visual C++ 2008 Express Edition

and about library the following libraries are whwat i used:

"C:\Program Files\OpenCV\lib"
"C:\Program Files\OpenCV\cv\include"
"C:\Program Files\OpenCV\cxcore\include"
"C:\Program Files\OpenCV\otherlibs\highgui"
"C:\Program Files\OpenCV\cvaux\include"
"C:\Program Files\OpenCV\otherlibs\_graphics\include"
"C:\Program Files\OpenCV\cv\src"
"C:\Program Files\OpenCV\cxcore\src"
"C:\Program Files\OpenCV\cvaux\src"
"C:\Program Files\OpenCV\otherlibs\highgui"
"C:\Program Files\OpenCV\otherlibs\_graphics\src"

回答1:


dunno what implementations are available in opencv, but a couple other libraries are:

  • JavaANPR

  • DTK ANPR




回答2:


if you are looking to learn more about OpenCV generally, you a good place to start is with this book: Learning OpenCV by Bradksi et al.




回答3:


I have recently been working on a simple implementation of ANPR in OpenCV python. You can check it out here

It is written with the help of Shogun Machine Learning toolbox with the Image processing part in OpenCV. Do play with the variables as they need some tweaking for cars from different regions.




回答4:


You can use the color of the ROI to create the filter. This will work until the plate region and the vehicle has the same color.

import cv2
import numpy as np

cap = cv2.VideoCapture(0)

while(1):
    _, frame = cap.read()
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    lower_red = np.array([30,150,50])
    upper_red = np.array([255,255,180])

    mask = cv2.inRange(hsv, lower_red, upper_red)
    res = cv2.bitwise_and(frame,frame, mask= mask)

    cv2.imshow('frame',frame)
    cv2.imshow('mask',mask)
    cv2.imshow('res',res)

    k = cv2.waitKey(5) & 0xFF
    if k == 27:
        break

cv2.destroyAllWindows()
cap.release()


来源:https://stackoverflow.com/questions/1971582/license-plate-recognition-using-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!