Book Image

Mastering OpenCV Android Application Programming

Book Image

Mastering OpenCV Android Application Programming

Overview of this book

Table of Contents (16 chapters)
Mastering OpenCV Android Application Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
6
Working with Image Alignment and Stitching
Index

Creating our application


Let's create a very basic Android application that will read images from your phone's gallery and display them on the screen using the ImageView control. The application will also have a menu option to open the gallery to choose an image.

We will start off by creating a new Eclipse (or an Android Studio) project with a blank activity, and let's call our application Features App.

Note

Before doing anything to the application, initialize OpenCV in your application (refer to Chapter 1, Applying Effects to Images, on how to initialize OpenCV in an Android project).

To the blank activity, add an ImageView control (used to display the image), as shown in the following code snippet:

<ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/image_view"
        android:visibility="visible"/>

In the application menu, add an OpenGallery menu option to open the phone's gallery and help us pick an image. For this...