# libcvautomation: Libcvautomation

libcvautomation 1.5

- Main Page
- Related Pages
- Classes
- Files

Libcvautomation

Author:
  Bradlee Speice <bspeice@uncc.edu>

## Introduction

Welcome to Libcvautomation! Libcvautomation is a GUI automation and testing tool based on image recognition and response. This program was designed as a direct replacement for Sikuli and Xpresser. I was having incredible difficulty getting either of these solutions to work - Sikuli would crash whenever I tried to take a screenshot, and Xpresser was both too new for our Prominent North American Enterprise Linux systems, but also didn't work or `import` correctly. I really liked the way each of these programs approached GUI automation, but they simply didn't work. Additionally, I wanted to create a simple solution - it does what you want it to, and that's it.

## How Libcvautomation Works

Libcvautomation represents two software products coming together - OpenCV and the XTest extension to the X11 server. OpenCV is used for image recognition, and XTest is used to actually drive the X server. You can dig into libcvautomation-xtest.h to get an idea of what all this library is capable of.
Basically what happens is that for whenever you need to do image recognition, OpenCV is used to find the images, and XTest is used to generate any events needed. Libcvautomation is mostly a wrapper to integrate both of these products, but also adds some functions like matchSubImage_X11() that allow you to match an image against the X11 root window in place. This means no more `'xwd | convert "<out_name>"'`.

## Installing Libcvautomation

Installing Libcvautomation is easy. You can either manually install packages, add the Libcvautomation repository, or install from tarball (the first option is recommended).

### Install Libcvautomation RPM Repository

If you want to make sure that you're using the latest (stable) version of Libcvautomation, you can add the Libcvautomation repository to yum. First, a new configuration file for the Libcvautomation repository:

     sudo vim /etc/yum.repos.d/libcvautomation.repo

After you have the file open, put the following content in it:

     [libcvautomation]
     name=Libcvautomation RPM repository
     baseurl=http://djbushido.github.com/libcvautomation/rpm
     enabled=1
     gpgcheck=0

And once this is done, clean out the cache, and you should be good to go!

     sudo yum clean all

Finally, if you want to begin developing application tests, you will need the following packages: `libcvautomation`, and `libcvautomation-examples`.

### Install Libcvautomation APT Repository

If you want to make sure that you're using the latest (stable) version of Libcvautomation, you can add the Libcvautomation repository to APT. First, open up your `sources.list`

     sudo vim /etc/apt/sources.list

Add the following content at the end:

     #Libcvautomation Repository
     deb http://djbushido.github.com/libcvautomation/apt libcvautomation/
     deb-src http://djbushido.github.com/libcvautomation/apt libcvautomation-source/

Run an update to make sure your packages refresh, and then you should be good to go!

     sudo apt-get update

Finally, if you want to begin developing application tests, you will need the following packages: `libcvautomation-dev`, and `libcvautomation-examples`.

### Manual Download Packages

If you want to manually download the packages, see the Github downloads page for libcvautomation: https://github.com/DjBushido/libcvautomation/downloads

### Manual Tarball Installation

If you want to install Libcvautomation via tarball, you can do that too. Download a release tarball from the Downloads page on Github: https://github.com/DjBushido/libcvautomation/downloads The source itself uses autotools, so it's incredibly easy to work with:

     cd <location_of_tarball>
     tar xf <tarball_file>
     cd libcvautomation-<release_number>
     ./configure
     make
     sudo make install

## Using Libcvautomation And Writing Application Tests

So how does one go about using libcvautomation?
I'm so glad you asked! I've provided a few reference programs - `cva-match` and `cva-input` - that can be used to demonstrate most of libcvautomation's capabilities. I've even provided a BASH wrapper to make it incredibly easy to use BASH with libcvautomation as well (requires that `cva-match` and `cva-input` are installed). Python bindings are on their way too.
Finally, if you want to know how to write your own application tests, please see Writing Application Tests for more information on that. I've provided code to give you a basic idea of how they work.

## Questions? Comments? Concerns?

Please send any feedback to <bspeice@uncc.edu>. Pull requests can be submitted to my github repository.

All Classes Files Functions Defines