To convince yourself that OpenCV's Java and C++ interfaces offer similar speed, you might want to measure the app's performance before and after the modifications that we will make in this chapter. A good overall measure of performance is the number of frames per second (FPS) that are processed by the onCameraFrame
callback. Optionally, OpenCV's CameraView
class can compute and display this FPS metric. When we enable CameraView
(in our onManagerConnected
callback), we can also enable the FPS meter, as seen in the following code:
@Override
public void onManagerConnected(final int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
Log.d(TAG, "OpenCV loaded successfully");
mCameraView.enableView();
mCameraView.enableFpsMeter();
//...
Although FPS is an important statistic, it does not tell us exactly how the app is using system resources. For example, we might want to know how much CPU time the app is spending...