There are many techniques for analyzing images for mobile apps.
Lot of solution offer many different features, and finding solution which perfectly match your needs may be difficult task. For one of our internal project, we need to analyse image for getting information about shapes (like rectangles, triangles and so on) which match our requirements.
To do it, we had to check some popular solutions for images processing. Our solution had to be compatible with both Android and iOS platform, because we did not want to implement our algorithm twice, and we would like to have exactly the same result on both platforms. You can see results of our research here:
There are many cloud solutions for image processing. For getting more accurate result they are using machine learning. Some of the most popular are: Google Vision API, Microsoft Computer Vision API and Amazon Rekognition. This kind of solutions can gives you informations about what is in your picture, like there is a car, or there is a wall etc.
Very often they have also implemented Face and smile detection feature, and OCR feature. We do not would like to compare this solutions and find the best of them - this is a topic for another blogpost. But we can ensure you that they are working really good and it is very difficult to get better results using other solutions mentioned in this blogpost.
However, in our case we do not need all of this perfect features - we only need to detect shapes in our image, and this solutions was not giving us required information about shapes. That is why, although this solutions are working really good, we had to find something different for our project.
Apple Vision API
Another solution is to use Apple Vision API, which is also using Machine Learning, but it has also build in solution for detecting and selecting basic shapes. It is working very well too, but as you may remember, we were looking for cross - platform solution, that is why finally we do not decided to use it
Other way is to use OpenCV - it is 100% offline solution, which is not using Machine Learning (However, it has Machine Learning module, so if you would like, you can use it - in our case, it was not required). Instead of it, it is returning descriptors which can help you analyze and get required information from image. It has build - in lot of features, like detecting shapes, polygons, colors blog etc.
This solution is quite popular, so it is easy to find help for your problem if you need it. It will not return you as good results as for example Cloud solutions if you would like to detect text or faces, but in some other cases, it may gives you results which you are not able to get using cloud solutions. In our case, it was the best solution.
Moreover, OpenCV is written in c++ language, that’s why we were able to extract algorithms to external files, and use this files on both platforms. As a result, we are using exactly the same algorithm on both platforms.
Of course, there are some alternatives to OpenCV, which are quite similar to it. One of them if BoofCV library. In official website you may find tests, which proves you that is is working faster than OpenCV. However, we were not able to find as much documentation and as much samples as we were able to find with OpenCV. That why finally we have not decided to use it.
As you may see, there are a lot of totally different solutions for analyzing images. In our case OpenCV was the best choice, however, depending on your use case, you may find something better for you. Finding the best solution may not be an easy task, but we hope, we can make it a little bit easier for you with this post.