mirror of
https://github.com/bspeice/libcvautomation
synced 2024-12-04 13:58:11 -05:00
Fix up the build process in preparation for release 1.0
This commit is contained in:
parent
9dc1d24926
commit
45905d8454
@ -31,9 +31,6 @@ AC_PATH_X
|
||||
#Configure OpenCV - version 2+ breaks a lot of things
|
||||
PKG_CHECK_MODULES([OpenCV], [opencv >= 2.0.0], [use_opencv2=true], [use_opencv1=true])
|
||||
AM_CONDITIONAL(USEOPENCV2, [test "$use_opencv2" != ""])
|
||||
if test "$use_opencv2" != ""; then
|
||||
AC_DEFINE(USEOPENCV2)
|
||||
fi
|
||||
if test "$use_opencv1" != ""; then
|
||||
echo "could not find OpenCV version 2.0.0 or higher, checking for 1.0.0 or higher..."
|
||||
PKG_CHECK_MODULES([OpenCV], [opencv >= 1.0.0])
|
||||
@ -47,7 +44,6 @@ AC_ARG_WITH(examples, [ --with-examples build example programs '['defau
|
||||
AM_CONDITIONAL(BUILD_EXAMPLES, [test "$with_examples" != "no"])
|
||||
if test "$with_examples" != "no"; then
|
||||
#Headers needed for cva-match
|
||||
echo building examples
|
||||
AC_CHECK_HEADERS([limits.h stdlib.h unistd.h])
|
||||
fi
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
#Need to include the -Ilibcvautomation so that libcvautomation.h can find everything that it needs
|
||||
AM_CFLAGS = -Wall -O2 -I$(top_srcdir)/include #-I$(top_srcdir)/include/libcvautomation
|
||||
if USEOPENCV2
|
||||
AM_LDFLAGS = -L../libcvautomation/.libs -lcvautomation `pkg-config --libs x11` -lopencv_imgproc -lopencv_core -lopencv_highgui -lXtst
|
||||
AM_CFLAGS = -Wall -Werror -O2 -I$(top_srcdir)/include/opencv2 #-I$(top_srcdir)/include/libcvautomation
|
||||
else
|
||||
AM_LDFLAGS = -L../libcvautomation/.libs -lcvautomation `pkg-config --libs x11` `pkg-config --libs opencv` -lXtst
|
||||
AM_CFLAGS = -Wall -Werror -O2 -I$(top_srcdir)/include/opencv1 #-I$(top_srcdir)/include/libcvautomation
|
||||
endif
|
||||
|
||||
#Build only if we're building the examples
|
||||
|
59
include/opencv1/libcvautomation/libcvautomation.h
Normal file
59
include/opencv1/libcvautomation/libcvautomation.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: libcvautomation.h
|
||||
*
|
||||
* Description: Include wrapper for libcvautomation subsections
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 06/21/2012 12:20:43 PM
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Bradlee Speice (), bspeice.nc@gmail.com
|
||||
* Organization:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#ifndef LIBCVAUTOMATION_H
|
||||
#define LIBCVAUTOMATION_H
|
||||
|
||||
/* C includes */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* OpenCV includes */
|
||||
#include <opencv/cv.h>
|
||||
#include <opencv/highgui.h>
|
||||
|
||||
/* X11 includes */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
/* Define a basic structure to help us with using multiple-picture arguments
|
||||
* Yes, it's a hackish implementation, nobody said you had to use this one. */
|
||||
typedef struct {
|
||||
/* Use one or the other of fileName or cvaImage - cvaImage takes priority */
|
||||
IplImage *cvaImage;
|
||||
char *fileName;
|
||||
|
||||
CvPoint resultPoint;
|
||||
int searchMethod;
|
||||
int tolerance;
|
||||
|
||||
} cvautomationList;
|
||||
|
||||
/* Define another basic structure for points */
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} cvaPoint;
|
||||
|
||||
/* Project component includes */
|
||||
/* The includes come here to make sure all function prototypes have access
|
||||
* to the cvautomationList struct */
|
||||
#include <libcvautomation/libcvautomation-opencv.h>
|
||||
#include <libcvautomation/libcvautomation-xlib.h>
|
||||
#include <libcvautomation/libcvautomation-xtest.h>
|
||||
|
||||
#endif /* LIBCVAUTOMATION_H */
|
56
include/opencv2/libcvautomation/libcvautomation-opencv.h
Normal file
56
include/opencv2/libcvautomation/libcvautomation-opencv.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: libcvautomation-opencv.h
|
||||
*
|
||||
* Description: Function definitions for opencv functionality
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 06/21/2012 08:34:21 AM
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Bradlee Speice, bspeice@uncc.edu
|
||||
* Organization: MOSAIC at University of North Carolina at Charlotte
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
#ifndef LIBCVAUTOMATION_OPENCV_H
|
||||
#define LIBCVAUTOMATION_OPENCV_H
|
||||
|
||||
#include <libcvautomation/libcvautomation.h>
|
||||
|
||||
/* It should be noted that the following are the macros for template matching:
|
||||
* CV_TM_SQDIFF (default)
|
||||
* CV_TM_SQDIFF_NORMED
|
||||
* CV_TM_CCORR
|
||||
* CV_TM_CCORR_NORMED
|
||||
* CV_TM_CCOEFF
|
||||
* CV_TM_CCOEFF_NORMED
|
||||
*/
|
||||
|
||||
/* Match a root image and sub image */
|
||||
CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
|
||||
/* Match a root image and sub image, return the center */
|
||||
CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
|
||||
/* Match a root image and sub image from filename */
|
||||
CvPoint matchSubImage_location ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
|
||||
/* Match a root image and sub image from filename, return the center */
|
||||
CvPoint matchSubImage_location_center ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
|
||||
/* Match a root image and sub images from an array of images */
|
||||
void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
/* Match a root image and sub images from an array of images, return the center */
|
||||
void matchSubImage_a_center ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
/* Match a root image and sub images from an array of images */
|
||||
void matchSubImage_a_location ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
/* Match a root image and sub images from an array of images, return the center */
|
||||
void matchSubImage_a_location_center ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_OPENCV_H */
|
51
include/opencv2/libcvautomation/libcvautomation-xlib.h
Normal file
51
include/opencv2/libcvautomation/libcvautomation-xlib.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: libcvautomation-xlib.h
|
||||
*
|
||||
* Description: Function definitions for X11 operations
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 06/21/2012 08:34:21 AM
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Bradlee Speice, bspeice@uncc.edu
|
||||
* Organization: MOSAIC at University of North Carolina at Charlotte
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
||||
#ifndef LIBCVAUTOMATION_XLIB_H
|
||||
#define LIBCVAUTOMATION_XLIB_H
|
||||
|
||||
#include <libcvautomation/libcvautomation.h>
|
||||
|
||||
/* It should be noted that the following are the macros for template matching:
|
||||
* CV_TM_SQDIFF (default)
|
||||
* CV_TM_SQDIFF_NORMED
|
||||
* CV_TM_CCORR
|
||||
* CV_TM_CCORR_NORMED
|
||||
* CV_TM_CCOEFF
|
||||
* CV_TM_CCOEFF_NORMED
|
||||
*/
|
||||
|
||||
/* Custom wrapper for XOpenDisplay function */
|
||||
Display* cvaOpenDisplay ( char *displayName );
|
||||
|
||||
/* Custom wrapper for XCloseDisplay funtion */
|
||||
void cvaCloseDisplay ( Display *displayLocation );
|
||||
|
||||
/* Match a sub image using the X11 root window as root */
|
||||
CvPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
|
||||
/* Match a sub image using the X11 root window as root, return the center */
|
||||
CvPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
|
||||
/* Match a sub image using X11 as root, from filename */
|
||||
CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subImage_location, int search_method, int tolerance );
|
||||
|
||||
/* Match a sub image using X11 as root, from filename, return the center */
|
||||
CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int search_method, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XLIB_H */
|
101
include/opencv2/libcvautomation/libcvautomation-xtest.h
Normal file
101
include/opencv2/libcvautomation/libcvautomation-xtest.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* =====================================================================================
|
||||
*
|
||||
* Filename: libcvautomation-xinput.h
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Version: 1.0
|
||||
* Created: 06/26/2012 09:08:41 AM
|
||||
* Revision: none
|
||||
* Compiler: gcc
|
||||
*
|
||||
* Author: Bradlee Speice (), bspeice.nc@gmail.com
|
||||
* Organization:
|
||||
*
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
||||
#ifndef LIBCVAUTOMATION_XTEST_H
|
||||
#define LIBCVAUTOMATION_XTEST_H
|
||||
|
||||
#include <libcvautomation/libcvautomation.h>
|
||||
|
||||
/* Make sure that the XTest extension is supported.
|
||||
* If it's not, return 0 (false) */
|
||||
Bool xte_XTestSupported ( Display *displayLocation );
|
||||
|
||||
/* Get the current location of the pointer */
|
||||
cvaPoint xte_pointerLocation ( Display *displayLocation );
|
||||
|
||||
/* Click the mouse where it is currently at */
|
||||
void xte_clickMouse ( Display *displayLocation, int mouseButton );
|
||||
|
||||
/* Click the mouse on an absolute screen location */
|
||||
void xte_clickMouseXY ( Display *displayLocation, int xLocation, int yLocation, int mouseButton );
|
||||
|
||||
/* Click the mouse on a screen location relative to where it currently is */
|
||||
void xte_clickMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement, int mouseButton );
|
||||
|
||||
/* Click the mouse at the top-left corner of an image on the specified display */
|
||||
cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
/* Click the mouse at the top-left corner of an image on the specified display
|
||||
* where the subImage is a file location */
|
||||
cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
/* Click the mouse at the center of an image on the specified display */
|
||||
cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
/* Click the mouse at the center of an image on the specified display
|
||||
* where the subImage is a file location */
|
||||
cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
/* Move the mouse to a location and leave it there */
|
||||
void xte_hoverMouseXY ( Display *displayLocation, int xLocation, int yLocation );
|
||||
|
||||
/* Move the mouse to a location relative to where it currently is and leave it there */
|
||||
void xte_hoverMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement );
|
||||
|
||||
/* Move the mouse to a location at the top-left corner of an image on the specified display
|
||||
* but don't click the mouse */
|
||||
cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
|
||||
/* Move the mouse to a location at the top-left corner of an image from file on the specified display
|
||||
* but don't click the mouse */
|
||||
cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *filename, int searchMethod, int tolerance );
|
||||
|
||||
/* Move the mouse to a location at the center of an image on the specified display
|
||||
* but don't click the mouse */
|
||||
cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
|
||||
/* Move the mouse to a location at the center of an image from file on the specified display
|
||||
* but don't click the mouse */
|
||||
cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance );
|
||||
|
||||
/* Push a mouse button down, but don't release it */
|
||||
void xte_mouseDown ( Display *displayLocation, int mouseButton );
|
||||
|
||||
/* Let a mouse button up */
|
||||
void xte_mouseUp ( Display *displayLocation, int mouseButton );
|
||||
|
||||
/* Move the mouse a little bit */
|
||||
void xte_mouseJiggle ( Display *displayLocation );
|
||||
|
||||
/* Press and release a key
|
||||
* Note that we use a string for *key, since keys like "space" are still valid. */
|
||||
void xte_clickKey ( Display *displayLocation, char *key );
|
||||
|
||||
/* Press and release keys in a string */
|
||||
void xte_clickKeyStr ( Display *displayLocation, char *string );
|
||||
|
||||
/* Press a key down */
|
||||
void xte_keyDown ( Display *displayLocation, char *key );
|
||||
|
||||
/* Release a key */
|
||||
void xte_keyUp ( Display *displayLocation, char *key );
|
||||
|
||||
/* Use one of the functions by command name */
|
||||
cvaPoint xte_commandString ( Display *displayLocation, char *command, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XTEST_H */
|
@ -22,19 +22,12 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef USEOPENCV2
|
||||
/* OpenCV2 includes - some filenames are different */
|
||||
/* OpenCV2 includes - some filenames are different
|
||||
* from the OpenCV1 counterparts */
|
||||
#include <opencv2/core/core_c.h>
|
||||
#include <opencv2/highgui/highgui_c.h>
|
||||
#include <opencv2/imgproc/imgproc_c.h>
|
||||
|
||||
#else
|
||||
/* OpenCV includes */
|
||||
#include <opencv/cv.h>
|
||||
#include <opencv/highgui.h>
|
||||
|
||||
#endif /* #ifdef OPENCV2 */
|
||||
|
||||
/* X11 includes */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
@ -1,4 +1,8 @@
|
||||
AM_CFLAGS = -Wall -O2 -I$(top_srcdir)/include
|
||||
if USEOPENCV2
|
||||
AM_CFLAGS = -Wall -Werror -O2 -I$(top_srcdir)/include/opencv2
|
||||
else
|
||||
AM_CFLAGS = -Wall -Werror -O2 -I$(top_srcdir)/include/opencv1
|
||||
endif
|
||||
AM_LDFLAGS =
|
||||
AM_LIBS = -shared
|
||||
|
||||
@ -8,4 +12,8 @@ libcvautomation_la_SOURCES = libcvautomation-opencv.c libcvautomation-opencv.h l
|
||||
#libcvautomation_CFLAGS = -shared -I$(top_srcdir)/include -I$(top_srcdir)/libcvautomation -I$(top_srcdir)/include/libcvautomation
|
||||
|
||||
#Lists the headers to distribute
|
||||
pkginclude_HEADERS = $(top_srcdir)/include/libcvautomation/libcvautomation.h $(top_srcdir)/include/libcvautomation/libcvautomation-opencv.h $(top_srcdir)/include/libcvautomation/libcvautomation-xlib.h $(top_srcdir)/include/libcvautomation/libcvautomation-xtest.h
|
||||
if USEOPENCV2
|
||||
pkginclude_HEADERS = $(top_srcdir)/include/opencv2/libcvautomation/libcvautomation.h $(top_srcdir)/include/opencv2/libcvautomation/libcvautomation-opencv.h $(top_srcdir)/include/opencv2/libcvautomation/libcvautomation-xlib.h $(top_srcdir)/include/opencv2/libcvautomation/libcvautomation-xtest.h
|
||||
else
|
||||
pkginclude_HEADERS = $(top_srcdir)/include/opencv1/libcvautomation/libcvautomation.h $(top_srcdir)/include/opencv1/libcvautomation/libcvautomation-opencv.h $(top_srcdir)/include/opencv1/libcvautomation/libcvautomation-xlib.h $(top_srcdir)/include/opencv1/libcvautomation/libcvautomation-xtest.h
|
||||
endif
|
||||
|
@ -582,10 +582,7 @@ void xte_keyUp ( Display *displayLocation, char *key )
|
||||
cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance )
|
||||
{
|
||||
/* Alright, this function bears a bit of talking about.
|
||||
* The way it works is that you give the **command two parameters:
|
||||
* [0]: The command
|
||||
* [1]: The command argument
|
||||
* And what happens is that I test here for the command, and pass it off.
|
||||
* What happens is that I test here for the command, and pass it off.
|
||||
* This functionality was inspired by xte from xautomation,
|
||||
* the original can be found at: http://hoopajoo.net/projects/xautomation.html
|
||||
* Most of the code for parsing is the same, just easier to do it that way. */
|
||||
@ -593,9 +590,13 @@ cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int
|
||||
/* Note that most of the functions don't need mouseButton, searchMethod, or tolerance,
|
||||
* but they're here to make sure that they're available if needed. */
|
||||
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = -1;
|
||||
resultPoint.y = -1;
|
||||
|
||||
/* Perform basic sanity checking */
|
||||
if (commandString == NULL)
|
||||
return;
|
||||
return resultPoint;
|
||||
|
||||
/* And now we sanitize the input */
|
||||
char *s_commandString;
|
||||
@ -734,9 +735,5 @@ cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int
|
||||
free(keyString);
|
||||
}
|
||||
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = -1;
|
||||
resultPoint.y = -1;
|
||||
|
||||
return resultPoint;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user