I apologize if this question has already been covered on this site, but I can’t seem to find a straight forward answer. I’m making an android app that uses OpenCV to take a picture, process it to detect objects, and figure out the coordinates of those objects in the scene.
All the tutorials I find for android seem to be real time processing of the camera preview or using c++, which I would strongly prefer to not have to go down the c++ road. I’m sure I’m missing something simple but I don’t know what it is.
On another note, the objects I’m trying to detect are billiards balls on a table. What would be the best pre-processing technique to better detect the balls? I did a quick test using the canny method, and it seems that the light reflecting off the balls breaks up the circle shape.
To load images in Android, you can use
where image1 is a image under Resources folder of your Android project.
Then convert Bitmap to bytes or Mat and process in C++ (OpenCV) or Java with matToBitmap or MatToBitmap methods in android-opencv.
If you are comfortable in processing using Mat data type, you can use (you need android-opencv project to use this)
You can use blobs, hough circles to detect billiard balls. There is no certain way to answer this. You can try using normalized RGB or Lab colorspaces to play around (to remove reflection of the billiard balls) to see if you detect billiard balls (by running hough circles, blob detectors).
The real-time scenario will require you to use machine-learning techniques to detect billiard balls by using certain feature vectors, then do training and testing.