简体   繁体   中英

How to use OCR (Optical Character Recognition) in an android app

This is my first post, so feel free to offer criticism on the post. I am interning at a small tech company and my first task is to create an app for them that will access their already existing web service. The company's web service is used by law enforcement to check if someone who is pulled over has car insurance. My employer wants me to use OCR to access the phone's camera and take a picture of the license plate. The app should then store the license plate number and use the web service to check if the vehicle has car insurance. My problem here is that I have never used OCR and I was wondering how I to implement and use it.

I am using AndroidStudio to make this app and the app will be on Android 10 (Q).

Assuming you already have the vehicle image:

  1. You can identify the region of interest of your input image (ie, in this case, the License Plate) using object detection . For this step check the OpenCV Library and YOLO .

  2. Once you have detected the License Plate you should perform the characters segmentation (check the article "Segmenting characters from license plates" for more insights)

  • PS, You may need to preprocess the image to reduce image noise, remove the plate frame, perform a binarization, etc.

  1. Using the image that you obtained in the previous step you can feed it to an OCR (Optical Character Recognition) engine in order to extract the text from the detected license plate . Check the Awesome-OCR repository for a detailed list of OCR libraries and engines.

  2. Finally, feed the OCR results to your insurance web service .

Other useful resources:

OCR is a separate process from taking a picture, in no way does OCR access the phone's camera. There are a number of OCR engines available that simply take an image as input and spit out the text found.

Here is a simple workflow:

  1. Take a picture
  2. Feed picture to OCR and get text back
  3. Validate text is a valid license plate
  4. Provide text to the insurance lookup system

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM