I created a license plate detection program with Python using OpenCv, the program takes in a picture of a license plate and it returns its numbers/letters. I wanted to incorporate my Python program into an iOS app using Swift. Is there a way I can provide an image from Swift and call the python script and get the returned value of the license plate?
Basically is there a way I can call python scripts from Swift?
Thanks
(I know I can translate the code over to C++ and create a bridge to Swift but I am not very familiar with C++)
You have not only to "call Python from swift", but to make it on the client, you have to embedd all the Python runtime and the OpenCV library with your application, run the Python app in a different application, and then work on making this call - which will be an interprocess call. Unless you can, from swift, instantiate an internal Python interpreter in native code (which is possible from C/C++ code, but I am not sure if it can done from Swift) - then you are spared from the separate process, but still will need to bundle everything.
However, if you can afford for the Python app to be run server side, then it should be trivial: you can use a microframework (like Flask), for example, to wrap your app functionality into a simple view. Your app would them just make an HTTP post request, send the image, and get the resulting text as a response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With