mirror of
https://github.com/bspeice/libcvautomation
synced 2024-12-04 13:58:11 -05:00
Switch everything to using cvaPoint rather than CvPoint
This commit is contained in:
parent
5fd67a57e6
commit
06804d6528
@ -36,7 +36,7 @@ typedef struct list basic_list;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
CvPoint result_point;
|
||||
cvaPoint result_point;
|
||||
result_point.x = result_point.y = 0;
|
||||
|
||||
/* Set up everything for getopt */
|
||||
|
@ -29,16 +29,16 @@
|
||||
*/
|
||||
|
||||
/* Match a root image and sub image */
|
||||
CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
cvaPoint 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 );
|
||||
cvaPoint 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 );
|
||||
cvaPoint 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 );
|
||||
cvaPoint 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 );
|
||||
|
@ -27,16 +27,16 @@ Display* cvaOpenDisplay ( char *displayName );
|
||||
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 );
|
||||
cvaPoint 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 );
|
||||
cvaPoint 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 );
|
||||
cvaPoint 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 );
|
||||
cvaPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int search_method, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XLIB_H */
|
||||
|
||||
@ -64,7 +64,7 @@ CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char
|
||||
* \returns Nothing
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
/** \fn cvaPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Return the location of a sub image in the X11 root window
|
||||
* \details This function wraps grabbing the X11 root window, converting it to IplImage format, and then giving this to matchSubImage()
|
||||
* \param displayLocation Pointer to the currently open X11 Display
|
||||
@ -75,7 +75,7 @@ CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char
|
||||
* \returns The location of the sub image in root X11 window
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
/** \fn cvaPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Return the center of a sub image in root X11 window, rather than the top-left corner
|
||||
* \details This function wraps grabbing the X11 root window, converting it to IplImage format, and then giving this to matchSubImage_center()
|
||||
* \param displayLocation Pointer to the currently open X11 Display
|
||||
@ -86,7 +86,7 @@ CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char
|
||||
* \returns The center location of the sub image in the root X11 window
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance );
|
||||
/** \fn cvaPoint matchSubImage_X11_location( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance );
|
||||
* \brief Return the location of a sub image in the X11 root window
|
||||
* \details This function wraps grabbing the X11 root window, converting it to IplImage format, and then giving this to matchSubImage_location()
|
||||
* \param displayLocation Pointer to the currently open X11 Display
|
||||
@ -97,7 +97,7 @@ CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char
|
||||
* \returns The center location of the sub image in the root X11 window
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance );
|
||||
/** \fn cvaPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance );
|
||||
* \brief Return the center of a sub image in the root X11 window, rather than the top-left corner
|
||||
* \details This function wraps grabbing the X11 root window, converting it to IplImage format, and then giving this to matchSubImage_location_center()
|
||||
* \param displayLocation Pointer to the currently open X11 Display
|
||||
|
@ -32,6 +32,11 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
/* Define another basic structure for points */
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} cvaPoint;
|
||||
|
||||
/* 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 {
|
||||
@ -39,17 +44,12 @@ typedef struct {
|
||||
IplImage *cvaImage;
|
||||
char *fileName;
|
||||
|
||||
CvPoint resultPoint;
|
||||
cvaPoint 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 */
|
||||
|
@ -24,25 +24,24 @@
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
||||
CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance )
|
||||
cvaPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance )
|
||||
{
|
||||
/* We have the two OpenCV images we want, go ahead and find if there are any matches */
|
||||
IplImage *result;
|
||||
CvPoint minloc, maxloc; /* Location for the match - depending on search algorithm,
|
||||
the result may be in either minloc or maxloc */
|
||||
CvPoint badpoint; /* (-1, -1), used to indicate an error */
|
||||
cvaPoint returnPoint; /* (-1, -1), used to indicate an error */
|
||||
double minval, maxval;
|
||||
int rootImage_width, rootImage_height;
|
||||
int subImage_width, subImage_height;
|
||||
int result_width, result_height;
|
||||
|
||||
badpoint.x = badpoint.y = -1;
|
||||
returnPoint.x = returnPoint.y = -1;
|
||||
|
||||
/* Make sure we have valid images */
|
||||
if ( rootImage == 0 || subImage == 0) {
|
||||
/* Otherwise return invalid */
|
||||
minloc.x = minloc.y = -1;
|
||||
return minloc;
|
||||
return returnPoint;
|
||||
}
|
||||
|
||||
/* Set up the parameters for our result image */
|
||||
@ -71,16 +70,26 @@ CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMetho
|
||||
if ( searchMethod == CV_TM_SQDIFF || searchMethod == CV_TM_SQDIFF_NORMED )
|
||||
{
|
||||
if ( minval < tolerance )
|
||||
return minloc;
|
||||
{
|
||||
returnPoint.x = minloc.x;
|
||||
returnPoint.y = minloc.y;
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
return badpoint;
|
||||
/* Return invalid */
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( maxval > tolerance )
|
||||
return maxloc;
|
||||
{
|
||||
returnPoint.x = maxloc.x;
|
||||
returnPoint.y = maxloc.y;
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
return badpoint;
|
||||
/* Return invalid */
|
||||
return returnPoint;
|
||||
}
|
||||
|
||||
} /* ----- end of function matchSubImage ----- */
|
||||
@ -91,7 +100,7 @@ CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMetho
|
||||
* Description: Match a root image and sub image from filename
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_location ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance )
|
||||
cvaPoint matchSubImage_location ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance )
|
||||
{
|
||||
/* This is basically a wrapper for matchSubImage( IplImage, IplImage )
|
||||
* All we do is load the images from the given filenames, and then
|
||||
@ -102,24 +111,24 @@ CvPoint matchSubImage_location ( const char *rootImage_location, const char *sub
|
||||
IplImage *subImage;
|
||||
subImage = cvLoadImage( subImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
CvPoint return_point;
|
||||
return_point.x = return_point.y = -1;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = resultPoint.y = -1;
|
||||
|
||||
/* Make sure we have good images */
|
||||
if ( rootImage == 0 || subImage == 0 )
|
||||
{
|
||||
/* Return error */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
return_point = matchSubImage( rootImage, subImage, searchMethod, tolerance );
|
||||
resultPoint = matchSubImage( rootImage, subImage, searchMethod, tolerance );
|
||||
|
||||
/* Free up the memory we created */
|
||||
cvReleaseImage( &rootImage );
|
||||
cvReleaseImage( &subImage );
|
||||
|
||||
/* Our return_point will already be NULL if there's no match */
|
||||
return return_point;
|
||||
/* Our resultPoint will already be invalid if there's no match */
|
||||
return resultPoint;
|
||||
|
||||
} /* ----- end of function matchSubImage ----- */
|
||||
|
||||
@ -136,7 +145,7 @@ void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
cvautomationList curr;
|
||||
|
||||
int x = 0;
|
||||
@ -174,7 +183,7 @@ void matchSubImage_a_location ( const char *rootImage_location, cvautomationList
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
cvautomationList curr;
|
||||
|
||||
IplImage *rootImage;
|
||||
@ -213,25 +222,24 @@ void matchSubImage_a_location ( const char *rootImage_location, cvautomationList
|
||||
* =====================================================================================
|
||||
*/
|
||||
|
||||
CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance )
|
||||
cvaPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance )
|
||||
{
|
||||
/* We have the two OpenCV images we want, go ahead and find if there are any matches */
|
||||
IplImage *result;
|
||||
CvPoint minloc, maxloc; /* Location for the match - depending on search algorithm,
|
||||
the result may be in either minloc or maxloc */
|
||||
CvPoint badpoint; /* (-1, -1), used to indicate an error */
|
||||
cvaPoint returnPoint; /* (-1, -1), used to indicate an error */
|
||||
double minval, maxval;
|
||||
int rootImage_width, rootImage_height;
|
||||
int subImage_width, subImage_height;
|
||||
int result_width, result_height;
|
||||
|
||||
badpoint.x = badpoint.y = -1;
|
||||
returnPoint.x = returnPoint.y = -1;
|
||||
|
||||
/* Make sure we have valid images */
|
||||
if ( rootImage == 0 || subImage == 0) {
|
||||
/* Otherwise return invalid */
|
||||
minloc.x = minloc.y = -1;
|
||||
return minloc;
|
||||
return returnPoint;
|
||||
}
|
||||
|
||||
/* Set up the parameters for our result image */
|
||||
@ -261,33 +269,36 @@ CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int sear
|
||||
{
|
||||
if ( minval < tolerance )
|
||||
{
|
||||
CvPoint resultPoint = minloc;
|
||||
returnPoint.x = minloc.x;
|
||||
returnPoint.y = minloc.y;
|
||||
/* Center the image before returning */
|
||||
resultPoint.x += (subImage->width) / 2;
|
||||
resultPoint.y += (subImage->height) / 2;
|
||||
returnPoint.x += (subImage->width) / 2;
|
||||
returnPoint.y += (subImage->height) / 2;
|
||||
|
||||
return resultPoint;
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
return badpoint;
|
||||
/* Return invalid */
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( maxval > tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
resultPoint = maxloc;
|
||||
returnPoint.x = maxloc.x;
|
||||
returnPoint.y = maxloc.y;
|
||||
/* Center the image before returning */
|
||||
resultPoint.x += (subImage->width) / 2;
|
||||
resultPoint.y += (subImage->height) / 2;
|
||||
returnPoint.x += (subImage->width) / 2;
|
||||
returnPoint.y += (subImage->height) / 2;
|
||||
|
||||
return resultPoint;
|
||||
return returnPoint;
|
||||
}
|
||||
else
|
||||
return badpoint;
|
||||
/* Return invalid */
|
||||
return returnPoint;
|
||||
}
|
||||
|
||||
} /* ----- end of function matchSubImage ----- */
|
||||
} /* ----- end of function matchSubImage_center ----- */
|
||||
|
||||
/*
|
||||
* === FUNCTION ======================================================================
|
||||
@ -298,7 +309,7 @@ CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int sear
|
||||
* we get the center of the sub-image.
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_location_center ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance )
|
||||
cvaPoint matchSubImage_location_center ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance )
|
||||
{
|
||||
/* This is basically a wrapper for matchSubImage( IplImage, IplImage )
|
||||
* All we do is load the images from the given filenames, and then
|
||||
@ -309,26 +320,26 @@ CvPoint matchSubImage_location_center ( const char *rootImage_location, const ch
|
||||
IplImage *subImage;
|
||||
subImage = cvLoadImage( subImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
CvPoint return_point;
|
||||
return_point.x = return_point.y = -1;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = resultPoint.y = -1;
|
||||
|
||||
/* Make sure we have good images */
|
||||
if ( rootImage == 0 || subImage == 0 )
|
||||
{
|
||||
/* Return error */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
return_point = matchSubImage_center( rootImage, subImage, searchMethod, tolerance );
|
||||
resultPoint = matchSubImage_center( rootImage, subImage, searchMethod, tolerance );
|
||||
|
||||
/* Free up the memory we created */
|
||||
cvReleaseImage( &rootImage );
|
||||
cvReleaseImage( &subImage );
|
||||
|
||||
/* Our return_point will already be NULL if there's no match */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
|
||||
} /* ----- end of function matchSubImage ----- */
|
||||
} /* ----- end of function matchSubImage_location_center ----- */
|
||||
|
||||
/*
|
||||
* === FUNCTION ======================================================================
|
||||
@ -346,7 +357,7 @@ void matchSubImage_a_center ( IplImage *rootImage, cvautomationList *subImageArr
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
cvautomationList curr;
|
||||
|
||||
int x = 0;
|
||||
@ -387,7 +398,7 @@ void matchSubImage_a_location_center ( const char *rootImage_location, cvautomat
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
cvautomationList curr;
|
||||
|
||||
IplImage *rootImage;
|
||||
|
@ -46,7 +46,7 @@ void cvaCloseDisplay ( Display *displayLocation )
|
||||
* Description: Match a sub image using the X11 root window as root
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
cvaPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
{
|
||||
/* First things first, grab the root X window and convert it to
|
||||
* the IplImage format.
|
||||
@ -54,7 +54,7 @@ CvPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int sea
|
||||
* http://opencv.willowgarage.com/wiki/ximage2opencvimage */
|
||||
IplImage *X_IPL;
|
||||
CvSize imageSize;
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
XImage *rootImage;
|
||||
XColor color;
|
||||
@ -197,7 +197,7 @@ CvPoint matchSubImage_X11( Display *displayLocation, IplImage *subImage, int sea
|
||||
* Description: Match a sub image using the X11 root window as root, from filename
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance )
|
||||
cvaPoint matchSubImage_X11_location( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance )
|
||||
{
|
||||
/* This is basically a wrapper for matchSubImage_X11( char *display, IplImage )
|
||||
* All we do is load the sub-image from the given filename, and then
|
||||
@ -206,25 +206,25 @@ CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subIma
|
||||
IplImage *subImage;
|
||||
subImage = cvLoadImage( subImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
CvPoint return_point;
|
||||
return_point.x = -1;
|
||||
return_point.y = -1;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = -1;
|
||||
resultPoint.y = -1;
|
||||
|
||||
/* Make sure we have a good image */
|
||||
if ( subImage == 0 )
|
||||
{
|
||||
/* Return error */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
return_point = matchSubImage_X11( displayLocation, subImage, searchMethod, tolerance );
|
||||
resultPoint = matchSubImage_X11( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
/* Free up the memory we created */
|
||||
cvReleaseImage( &subImage );
|
||||
|
||||
/* Our return_point will already be bad if there's no match,
|
||||
/* Our resultPoint will already be bad if there's no match,
|
||||
* we don't need to worry about setting it. */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
|
||||
} /* ----- end of function matchSubImage_X11_location ----- */
|
||||
|
||||
@ -237,7 +237,7 @@ CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subIma
|
||||
* the top-left corner.
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
cvaPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
{
|
||||
/* First things first, grab the root X window and convert it to
|
||||
* the IplImage format.
|
||||
@ -245,7 +245,7 @@ CvPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage,
|
||||
* http://opencv.willowgarage.com/wiki/ximage2opencvimage */
|
||||
IplImage *X_IPL;
|
||||
CvSize imageSize;
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
XImage *rootImage;
|
||||
XColor color;
|
||||
@ -388,7 +388,7 @@ CvPoint matchSubImage_X11_center( Display *displayLocation, IplImage *subImage,
|
||||
* Description: Match a sub image using the X11 root window as root, from filename
|
||||
* =====================================================================================
|
||||
*/
|
||||
CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance )
|
||||
cvaPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int searchMethod, int tolerance )
|
||||
{
|
||||
/* This is basically a wrapper for matchSubImage_X11( char *display, IplImage )
|
||||
* All we do is load the sub-image from the given filename, and then
|
||||
@ -397,24 +397,24 @@ CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char
|
||||
IplImage *subImage;
|
||||
subImage = cvLoadImage( subImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
CvPoint return_point;
|
||||
return_point.x = -1;
|
||||
return_point.y = -1;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint.x = -1;
|
||||
resultPoint.y = -1;
|
||||
|
||||
/* Make sure we have a good image */
|
||||
if ( subImage == 0 )
|
||||
{
|
||||
/* Return error */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
return_point = matchSubImage_X11_center( displayLocation, subImage, searchMethod, tolerance );
|
||||
resultPoint = matchSubImage_X11_center( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
/* Free up the memory we created */
|
||||
cvReleaseImage( &subImage );
|
||||
|
||||
/* Our return_point will already be bad if there's no match,
|
||||
/* Our resultPoint will already be bad if there's no match,
|
||||
* we don't need to worry about setting it. */
|
||||
return return_point;
|
||||
return resultPoint;
|
||||
|
||||
} /* ----- end of function matchSubImage_X11_location_center ----- */
|
||||
|
@ -139,17 +139,13 @@ cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int
|
||||
* Find where the cursor is currently at
|
||||
* Move the cursor to the given point using relative motion -
|
||||
* This method is screen-agnostic */
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
resultPoint = matchSubImage_X11 ( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -165,7 +161,7 @@ cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -177,17 +173,13 @@ cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int
|
||||
*/
|
||||
cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
resultPoint = matchSubImage_X11_location( displayLocation, fileName, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -203,7 +195,7 @@ cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fi
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -219,17 +211,13 @@ cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subIma
|
||||
* Find where the cursor is currently at
|
||||
* Move the cursor to the given point using relative motion -
|
||||
* This method is screen-agnostic */
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
resultPoint = matchSubImage_X11_center ( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -245,7 +233,7 @@ cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subIma
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -257,17 +245,13 @@ cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subIma
|
||||
*/
|
||||
cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
|
||||
resultPoint = matchSubImage_X11_location_center( displayLocation, fileName, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -283,7 +267,7 @@ cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const c
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -329,16 +313,12 @@ void xte_hoverMouseRXY ( Display *displayLocation, int xIncrement, int yIncremen
|
||||
*/
|
||||
cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint = matchSubImage_X11( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -351,7 +331,7 @@ cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -363,16 +343,12 @@ cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int
|
||||
*/
|
||||
cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint = matchSubImage_X11_location( displayLocation, fileName, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -385,7 +361,7 @@ cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *fi
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -397,16 +373,12 @@ cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *fi
|
||||
*/
|
||||
cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint = matchSubImage_X11_center( displayLocation, subImage, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -419,7 +391,7 @@ cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subIma
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -431,16 +403,12 @@ cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subIma
|
||||
*/
|
||||
cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance )
|
||||
{
|
||||
CvPoint resultPoint;
|
||||
cvaPoint resultPoint;
|
||||
resultPoint = matchSubImage_X11_location_center( displayLocation, fileName, searchMethod, tolerance );
|
||||
|
||||
cvaPoint result;
|
||||
result.x = resultPoint.x;
|
||||
result.y = resultPoint.y;
|
||||
|
||||
if (resultPoint.x == -1 && resultPoint.y == -1)
|
||||
/* Match not found */
|
||||
return result;
|
||||
return resultPoint;
|
||||
|
||||
cvaPoint pointerLocation;
|
||||
pointerLocation = xte_pointerLocation( displayLocation );
|
||||
@ -453,7 +421,7 @@ cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const c
|
||||
|
||||
XFlush( displayLocation );
|
||||
|
||||
return result;
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user