O'Reilly logo

Android Application Programming with OpenCV by Joseph Howse

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the tracker filters to CameraActivity

To use instances of ImageDetectionFilter, we make the same kind of modifications to CameraActivity as we did for other filters in the previous chapter. Recall that all our filter classes implement the Filter interface so that CameraActivity can use them all in similar ways.

First, we need to define some text (for the menu button) in res/values/strings.xml:

  <string name="menu_next_image_detection_filter">Next
    Tracker</string>

Next, we need to define the menu button itself in res/menu/activity_camera.xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_next_image_detection_filter" android:orderInCategory="100" android:showAsAction="ifRoom|withText" android:title="@string/menu_next_image_detection_filter" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required