twelve17/openalpr-ios

how use alpr in xcode?

olivero86 opened this issue · 16 comments

I think I successfully installed openalpr-ios and linked it in my xcode project. however, I have no idea how to use it in xcode? thank you, your help is greatly appreciated!

Have you had a chance to go through the Readme? Do you have a specific question?

yes. I have an image (UIImage) in my app and would like to recognize the license plate. Is there a function I could call to do that?
Thank you so much!

Are you familiar with the openalpr library?

no, just saw the demo on the website and installed it with your manual.

openalpr has an API for taking an image and returning plate candidates. You may want to get a little familiar with that first. The main class on the project is a good reference to use as an example.

I think I can understand what this class does but I still have no idea how to use it in my ios app? can you give me a hint what to do or maybe a sample project?

Unfortunately I don't have a sample project I can post at the moment. But the various parts are goog-able. You will need to know:

  • How to include the openalpr headers in your own project
  • How to "link to" the openalpr library in your own project
  • How to use C++ classes in Xcode projects (mainly this means renaming the impl classes with an '.mm' extension)
  • How to convert an UIImage to OpenCV Mat

hmm ok, I thought your openalpr-ios did some of that already?

I don't have a simple openalpr-ios project. It's mingled with an app I'm working on, and has hardcoded paths to include openalpr. I haven't yet learned how to create Xcode projects dynamically via a script, like OpenCV does with its iOS python script, so it would still take manual tweaking to get it working elsewhere.

I haven't had a chance to extract out the generic stuff from the proprietary stuff I am not allowed to release. I'm also not working with UIImages, but I am sure there are samples online for doing the conversion from them. All the other items are generic concepts that apply to any C++ library you might use in Xcode.

I'm also waiting until Tesseract 3.03 is released, so that then it can just be a CocoaPod dependency, which should make management of an openalpr Xcode project easier.

Ok I'll try to do that but just for my understanding, what did I do by following ur openalpr-ios readme? None of the "various parts" above?
Thanks

I believe that the instructions in the readme would get you the first two items on that list. Then it's a matter of including the alpr header in a objective C++ class in your project, and using the openalpr API to get plates from a OpenCV mat.

I got the conversion for the UIImage. Could you give me a hint which classes I need?

I'm not sure what you mean. Can you be more specific? Do you have the code somewhere?

looks like I got the these things covered:
How to include the openalpr headers in your own project
How to "link to" the openalpr library in your own project
How to convert an UIImage to OpenCV Mat

now I think I have to include the right openalpr classes as you stated by this "How to use C++ classes in Xcode projects (mainly this means renaming the impl classes with an '.mm' extension)"
Problem is I'm not sure which classes I'll need?

Would you be interested in setting up a demo xcode project in swift for me? I'll pay for it of course!

I'm afraid I am not experienced with swift at the moment. The classes you need are shown in openalpr's main.cpp class. Tinker around with code from that class for a bit, and you will see what you need.

For v2 of this project, I have replaced the old instructions and bash scripts with a Ruby script to build the OpenALPR and dependency Frameworks, as well as the OpenALPR Xcode project. A sample app is included. These changes have been pushed to the master branch, and the old version has been moved to branch 1_0. Feel free to check out this new script and see if it works for you. I will no longer be working on or supporting the 1_0 codebase.