I am trying to implement an application for quick tracking of objects on Android
My logic is as follows
- Remove all colors except the desired color range.
- Smooth image using GaussianBlur
- Find the largest circle radius with HoughCircles
The view of the application works fine, but the performance is poor, and I would like to speed up my work at least 5 times faster. I borrowed most of the logic from this link.
Example of quick tracking of objects
public void apply(Mat src, Mat dst) { Mat mIntermediateMat = new Mat(src.rows(), src.cols(), CvType.CV_8UC1); Mat mHsv = new Mat(src.size(), CvType.CV_8UC3); Mat mHsv2 = new Mat(src.size(), CvType.CV_8UC3); Imgproc.cvtColor(src, mHsv, Imgproc.COLOR_RGB2HSV, 3); Core.inRange(mHsv, new Scalar(0, 86, 72), new Scalar(39, 255, 255), mHsv);
I was thinking about how to increase my productivity, and I would like tips that can be viable and significant.
1) Using Multi Threading. I could use a stream to capture from the camera and one to process the image. From the OpenCV release notes for Android, I see "Enabled multithreaded support with TBB (only a few features have been optimized at the moment)." However, I do not understand this. Is TBB for Intel chips only? What features are available? Are there suitable examples for Android and OpenCV?
2) Using a more powerful Android device. I am currently working on a 2012 Nexus 7 using the front camera. I'm actually not very good at what specifications are important to me. Nexus 7 (2012) has a quad-core processor NVIDIA Tegra 3 with a clock frequency of 1.3 GHz; 416 MHz NVIDIA GeForce ULP GPU.
If I had to run the fastest Android mobile handset now, how much will it differ?
What specifications are most important for this type of application
- CPU.
- GPU
- The number of cores.
- Camera frame rate.
3) Does Native C ++ use code that positively affects my performance?
4) Are there alternatives to OpenCV that I could use?