mirror of
https://github.com/bspeice/libcvautomation
synced 2024-12-04 13:58:11 -05:00
Commit initial documentation
This commit is contained in:
parent
0f15820c81
commit
e71c17cf5c
1259
documentation/Doxyfile
Normal file
1259
documentation/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@ -54,3 +54,144 @@ void matchSubImage_a_location ( const char *rootImageFileName, cvautomationList
|
||||
void matchSubImage_a_location_center ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_OPENCV_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-opencv.h
|
||||
* \brief The source code to access libcv from inside libcvautomation.
|
||||
* \details This source file builds in the necessary functionality to use libcv functions inside libcvautomation.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \page libcv_search_methods Libcv Search Methods
|
||||
This page describes the methods libcv uses to search for a sub image in a root image.
|
||||
\section SQDIFF Squared Difference
|
||||
\code #define CV_TM_SQDIFF 0 \endcode
|
||||
Squared Difference is the default search method used by \c libcvautomation, as well as \c cva-match and \c cva-input.
|
||||
\par For this method, setting a low tolerance value results in a more strict match.
|
||||
Formula:
|
||||
\f$R(x,y) = \sum_{x',y'} (T(x',y') - I(x + x', y+y'))^2 \f$
|
||||
|
||||
\section SQDIFF_NORMED Squared Difference (Normalized)
|
||||
\code #define CV_TM_SQDIFF_NORMED 1 \endcode
|
||||
This is a normalized version of the \ref SQDIFF search method.
|
||||
\par For this method, setting a low tolerance value results in a more strict match.
|
||||
Formula:
|
||||
\f$ R(x,y) = \frac{\sum_{x',y'}(T(x',y') - I(x + x', y + y'))^2}{ \sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'}I(x + x', y + y')^2}} \f$
|
||||
|
||||
\section CCORR Cross Correlation
|
||||
\code #define CV_TM_CCORR 2 \endcode
|
||||
This is the Cross Correlation search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y')) \f$
|
||||
|
||||
\section CCORR_NORMED Cross Correlation (Normalized)
|
||||
\code #define CV_TM_CCORR_NORMED 3 \endcode
|
||||
This is the normalized version of the \ref CCORR search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I'(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}} \f$
|
||||
|
||||
\section CCOEFF Correlation Coefficient
|
||||
\code #define CV_TM_CCOEFF 4 \endcode
|
||||
This is the Correlation Coefficient search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I(x+x',y+y')) \f$
|
||||
where:
|
||||
\f$ \begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array} \f$
|
||||
|
||||
\section CCOEFF_NORMED Correlation Coefficient (Normalized)
|
||||
\code #define CV_TM_CCOEFF_NORMED 5 \endcode
|
||||
This is the normalized version of the \ref CCOEFF search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} } \f$
|
||||
*/
|
||||
|
||||
|
||||
/** \fn CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
* \brief Return the location of a sub image in its root image
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImage The sub image (in IplImage format) to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see \ref libcv_search_methods
|
||||
* \return The location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
* \brief Return the center of a sub image in its root image, rather than the top-left corner
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImage The sub image (in IplImage format) to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The center location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_location ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
* \brief Return the location of a sub image in its root image
|
||||
* \details The difference that this function has over matchSubImage() is that \e rootImage_location and \e subImage_location are from files, rather than an IplImage format image.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImage_location The location of the sub image to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_location_center ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
* \brief Return the center of a sub image in its root image, rather than the top-left corner
|
||||
* \details The difference that this function has over matchSubImage_center() is that \e rootImage_location and \e subImage_location are from files, rather than an IplImage format image.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImage_location The location of the sub image to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The center location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage()
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImageArray The sub image array to search for in \c rootImage - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_center ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage_center()
|
||||
* \details Uses the cvautomationList.cvaImage parameter to find a \c subImage in \c rootImage
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImageArray The sub image array to search for in \c rootImage - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_location ( const char *rootImage_location, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage()
|
||||
* \details The difference between this and matchSubImage_a() is that this uses a root image from filename, rather than from an IplImage format.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImageArray The sub image array to search for in \c rootImage_location - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_location_center ( const char *rootImage_location, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage_center()
|
||||
* \details The difference that this function has over matchSubImage_a_center() is that \c rootImage_location is from a file
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImageArray The sub image array to search for in \c rootImage_location - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
@ -21,15 +21,6 @@
|
||||
|
||||
#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 );
|
||||
|
||||
@ -49,3 +40,70 @@ CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subIma
|
||||
CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int search_method, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XLIB_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-xlib.h
|
||||
* \brief The source code to access Xlib from inside libcvautomation
|
||||
* \details This source file builds in the necessary functionality to use libcv functions inside libcvautomation.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \fn Display* cvaOpenDisplay ( char *displayName );
|
||||
* \brief Simple wrapper for XOpenDisplay
|
||||
* \details Currently this function literally just passes off to XOpenDisplay, but is designed to be used in the future if extra functionality is needed.
|
||||
* \param displayName The name of the display to open - '' is a valid name
|
||||
* \returns Pointer to the opened X11 Display
|
||||
*/
|
||||
|
||||
/** \fn void cvaCloseDisplay ( Display *displayLocation );
|
||||
* \brief Simple wrapper for XCloseDisplay
|
||||
* \details Currently this function literally just passes off to XCloseDisplay, but is designed to be used in the future if extra functionality is needed.
|
||||
* \param displayLocation Pointer to the display to close
|
||||
* \returns Nothing
|
||||
*/
|
||||
|
||||
/** \fn CvPoint 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
|
||||
* \param subImage The sub image (in IplImage format) to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \returns The location of the sub image in root X11 window
|
||||
*/
|
||||
|
||||
/** \fn CvPoint 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
|
||||
* \param subImage The sub image (in IplImage format) to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \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 );
|
||||
* \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
|
||||
* \param subImage_location The location of the sub image to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \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 );
|
||||
* \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
|
||||
* \param subImage_location The location of the sub image to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \returns The center location of the sub image in the root X11 window
|
||||
*/
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
#include <libcvautomation/libcvautomation.h>
|
||||
|
||||
#define IS_CMD( x, y ) strncmp( x, y, strlen( y ) ) == 0
|
||||
#define COMMAND_STR_LEN 512
|
||||
|
||||
/* Make sure that the XTest extension is supported.
|
||||
* If it's not, return 0 (false) */
|
||||
Bool xte_XTestSupported ( Display *displayLocation );
|
||||
@ -96,6 +99,539 @@ void xte_keyDown ( Display *displayLocation, char *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 );
|
||||
cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XTEST_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-xtest.h
|
||||
* \brief The source code to access the XTest extension inside libcvautomation
|
||||
* \details This source file builds in the necessary functionality to drive the X11 server in libcvautomation
|
||||
* \author Bradlee Speice
|
||||
* \date 6/26/2012
|
||||
*/
|
||||
|
||||
/** \page XTest_key_strings XTest Key Strings
|
||||
This page describes the various extra key strings to use with X11.
|
||||
The following list is generated with this command:
|
||||
\code xmodmap -pke | cut -d'=' -f2 | sed 's/ /\n/g' | tr -s '\n' | awk '{ print length(), $0 | "sort -n" }' | cut -d' ' -f2 | uniq \endcode
|
||||
\code
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
a
|
||||
A
|
||||
b
|
||||
B
|
||||
c
|
||||
C
|
||||
d
|
||||
D
|
||||
e
|
||||
E
|
||||
f
|
||||
F
|
||||
g
|
||||
G
|
||||
h
|
||||
H
|
||||
i
|
||||
I
|
||||
j
|
||||
J
|
||||
k
|
||||
K
|
||||
l
|
||||
L
|
||||
m
|
||||
M
|
||||
n
|
||||
N
|
||||
o
|
||||
O
|
||||
p
|
||||
P
|
||||
q
|
||||
Q
|
||||
r
|
||||
R
|
||||
s
|
||||
S
|
||||
t
|
||||
T
|
||||
u
|
||||
U
|
||||
v
|
||||
V
|
||||
w
|
||||
W
|
||||
x
|
||||
X
|
||||
y
|
||||
Y
|
||||
z
|
||||
Z
|
||||
at
|
||||
F1
|
||||
F2
|
||||
F3
|
||||
F4
|
||||
F5
|
||||
F6
|
||||
F7
|
||||
F8
|
||||
F9
|
||||
Up
|
||||
bar
|
||||
End
|
||||
F10
|
||||
F11
|
||||
F12
|
||||
Tab
|
||||
Down
|
||||
Home
|
||||
KP_0
|
||||
KP_1
|
||||
KP_2
|
||||
KP_3
|
||||
KP_4
|
||||
KP_5
|
||||
KP_6
|
||||
KP_7
|
||||
KP_8
|
||||
KP_9
|
||||
Left
|
||||
less
|
||||
Menu
|
||||
Next
|
||||
plus
|
||||
Alt_L
|
||||
Break
|
||||
colon
|
||||
comma
|
||||
equal
|
||||
grave
|
||||
KP_Up
|
||||
minus
|
||||
Pause
|
||||
Print
|
||||
Prior
|
||||
Right
|
||||
slash
|
||||
space
|
||||
aacute
|
||||
Aacute
|
||||
dagger
|
||||
Delete
|
||||
dollar
|
||||
eacute
|
||||
Eacute
|
||||
Escape
|
||||
exclam
|
||||
iacute
|
||||
Iacute
|
||||
Insert
|
||||
KP_Add
|
||||
KP_End
|
||||
Meta_L
|
||||
oacute
|
||||
Oacute
|
||||
period
|
||||
Return
|
||||
uacute
|
||||
Uacute
|
||||
greater
|
||||
Hyper_L
|
||||
KP_Down
|
||||
KP_Home
|
||||
KP_Left
|
||||
KP_Next
|
||||
percent
|
||||
Shift_L
|
||||
Shift_R
|
||||
Super_L
|
||||
Super_R
|
||||
Sys_Req
|
||||
XF86WWW
|
||||
asterisk
|
||||
KP_Begin
|
||||
KP_Enter
|
||||
KP_Equal
|
||||
KP_Prior
|
||||
KP_Right
|
||||
NoSymbol
|
||||
Num_Lock
|
||||
question
|
||||
quotedbl
|
||||
XF86Back
|
||||
XF86Mail
|
||||
XF86Stop
|
||||
XF86WLAN
|
||||
ampersand
|
||||
backslash
|
||||
BackSpace
|
||||
braceleft
|
||||
brokenbar
|
||||
Caps_Lock
|
||||
Control_L
|
||||
Control_R
|
||||
KP_Delete
|
||||
KP_Divide
|
||||
KP_Insert
|
||||
parenleft
|
||||
semicolon
|
||||
XF86Eject
|
||||
XF86Sleep
|
||||
adiaeresis
|
||||
Adiaeresis
|
||||
apostrophe
|
||||
asciitilde
|
||||
braceright
|
||||
ediaeresis
|
||||
Ediaeresis
|
||||
idiaeresis
|
||||
KP_Decimal
|
||||
numbersign
|
||||
odiaeresis
|
||||
Odiaeresis
|
||||
parenright
|
||||
udiaeresis
|
||||
Udiaeresis
|
||||
underscore
|
||||
XF86Reload
|
||||
XF86Search
|
||||
XF86WakeUp
|
||||
asciicircum
|
||||
bracketleft
|
||||
KP_Multiply
|
||||
KP_Subtract
|
||||
Mode_switch
|
||||
Scroll_Lock
|
||||
XF86Battery
|
||||
XF86Display
|
||||
XF86Forward
|
||||
XF86_Ungrab
|
||||
bracketright
|
||||
doubledagger
|
||||
ISO_Left_Tab
|
||||
XF86PowerOff
|
||||
XF86AudioMute
|
||||
XF86AudioNext
|
||||
XF86AudioPrev
|
||||
XF86AudioStop
|
||||
XF86Favorites
|
||||
XF86AudioMedia
|
||||
XF86AudioPause
|
||||
XF86Calculator
|
||||
XF86_ClearGrab
|
||||
XF86MyComputer
|
||||
XF86_Next_VMode
|
||||
XF86_Prev_VMode
|
||||
ISO_Level3_Shift
|
||||
Terminate_Server
|
||||
XF86_Switch_VT_1
|
||||
XF86_Switch_VT_2
|
||||
XF86_Switch_VT_3
|
||||
XF86_Switch_VT_4
|
||||
XF86_Switch_VT_5
|
||||
XF86_Switch_VT_6
|
||||
XF86_Switch_VT_7
|
||||
XF86_Switch_VT_8
|
||||
XF86_Switch_VT_9
|
||||
XF86KbdLightOnOff
|
||||
XF86_Switch_VT_10
|
||||
XF86_Switch_VT_11
|
||||
XF86_Switch_VT_12
|
||||
Pointer_EnableKeys
|
||||
XF86KbdBrightnessUp
|
||||
XF86MonBrightnessUp
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86KbdBrightnessDown
|
||||
XF86MonBrightnessDown
|
||||
\endcode
|
||||
\warning Please note that each key string above is first translated into a key code, and then into the actual key click. Thus, while you might intend to press "dollar", it will actually come out as "4".
|
||||
*/
|
||||
|
||||
/** \page XTest_command_strings xte_commandString() Command Strings
|
||||
This page describes the various command strings available for the \ref xte_commandString() function.
|
||||
\section mouseclick Mouse Click
|
||||
\code 'mouseclick <button_number>' \endcode
|
||||
Click the mouse button \c <button_number> in-place.
|
||||
\warning This command has no arguments.
|
||||
|
||||
\section imouseclick Image Mouse Click
|
||||
\code 'imouseclick <image_name>' \endcode
|
||||
Click the mouse at an image's top-left corner.
|
||||
|
||||
\section icmouseclick Image Mouse Click (Centered)
|
||||
\code 'icmouseclick <image_name>' \endcode
|
||||
Click the mouse at an image's center.
|
||||
|
||||
\section mousexy Mouse XY Move
|
||||
\code 'mousexy <x-coord> <y-coord>' \endcode
|
||||
Move the mouse to an absolute coordinate.
|
||||
\warning The \c <x-coord> and \c <y-coord> are expected to be integers.
|
||||
|
||||
\section mouserxy Mouse XY Move (Relative)
|
||||
\code 'mouserxy <x-increment> <y-increment>' \endcode
|
||||
Move the mouse by the given x and y values (relative motion).
|
||||
\par A positive X increment will move the mouse to the right, and a positive Y increment will move the mouse down.
|
||||
\warning The \c <x-increment> and \c <y-increment> are expected to be integers.
|
||||
|
||||
\section mouseimage Mouse Image Move
|
||||
\code 'mouseimage <image_name>' \endcode
|
||||
Move the mouse to an image's top-left corner.
|
||||
|
||||
\section cmouseimage Mouse Image Move (Centered)
|
||||
\code 'cmouseimage <image_name>' \endcode
|
||||
Move the mouse to an image's center.
|
||||
|
||||
\section mousedown Mouse Button Down
|
||||
\code 'mousedown <button_number>' \endcode
|
||||
Push and leave down a mouse button.
|
||||
|
||||
\section mouseup Mouse Button Up
|
||||
\code 'mouseup <button_number>' \endcode
|
||||
Release mouse button \c <button_number>
|
||||
|
||||
\section mousejiggle Mouse Jiggle
|
||||
\code 'mousejiggle' \endcode
|
||||
Jiggle the mouse (helps to activate some widgets). Moves the mouse right and down 1 pixel, and then back.
|
||||
|
||||
\section keyclick Key Button Click
|
||||
\code 'keyclick <key_name>' \endcode
|
||||
Push and release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keydown Key Button Down
|
||||
\code 'keydown <key_name>' \endcode
|
||||
Push down <em>but do not release</em> a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keyup Key Button Up
|
||||
\code 'keyup <key_name>' \endcode
|
||||
Release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keystring Keyboard Input String
|
||||
\code 'keystring <string>' \endcode
|
||||
Input a string of text to the X11 server. For example, inputting 'Hello, world!" will act as if you typed 'Hello, world!' from the keyboard.
|
||||
\warning Unlike \ref keydown, \ref keyup, and \ref keyclick, this function can not handle special keys like 'Space'.
|
||||
*/
|
||||
|
||||
/** \def IS_CMD (x, y)
|
||||
* \brief Checks if string \c 'x' is in \c 'y'
|
||||
* \details Performs a safe check to see if x is in y - this way, you can check that \c "command" is inside \c "command argument"*/
|
||||
|
||||
/** \def COMMAND_STR_LEN
|
||||
* \brief Specifies the maximum length of a command string*/
|
||||
|
||||
/** \fn Bool xte_XTestSupported ( Display *displayLocation );
|
||||
* \brief Check if the XTest extension is supported
|
||||
* \param displayLocation The Display to check if XTest is supported on
|
||||
* \returns True if XTest is supported, False otherwise
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_pointerLocation ( Display *displayLocation );
|
||||
* \brief Grab the current location of the pointer
|
||||
* \param displayLocation The Display of which to grab the pointer location from
|
||||
* \returns cvaPoint with the current location of the pointer
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouse ( Display *displayLocation, int mouseButton );
|
||||
* \brief Click the mouse in its current location
|
||||
* \details Perform a mouse-down and mouse-up event on button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouseXY ( Display *displayLocation, int xLocation, int yLocation, int mouseButton );
|
||||
* \brief Click the mouse button at an absolute location
|
||||
* \details Move the mouse to location (\c xLocation, \c yLocation ) and then click button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param xLocation The X-coordinate to move the mouse to before clicking
|
||||
* \param yLocation The Y-location to move the mouse to before clicking
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement, int mouseButton );
|
||||
* \brief Click the mouse button at a relative location
|
||||
* \details Move the mouse horizontally \c xIncrement and vertically \c yIncrement before clicking button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param xIncrement Move the mouse horizontally this many pixels - positive value is motion to the right
|
||||
* \param yIncrement Move the mouse vertically this many pixels - positive value is motion downwards
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding \c subImage in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on the location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the sub image from \c fileName in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on center location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center of \c subImage in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on the center location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center location of the sub image from \c fileName in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn void xte_hoverMouseXY ( Display *displayLocation, int xLocation, int yLocation );
|
||||
* \brief Move the mouse to a location, but do not click it
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
* \param xLocation The X-coordinate of which to move the mouse
|
||||
* \param yLocation The Y-coordinate of which to move the mouse
|
||||
*/
|
||||
|
||||
/** \fn void xte_hoverMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement );
|
||||
* \brief Move the mouse to a relative location, but do not click it
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
* \param xIncrement How far to move the mouse horizontally. Positive values indicate motion to the right.
|
||||
* \param yIncrement How far to move the mouse vertically. Positive values indicate motion downward.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding \c subImage in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *filename, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the sub image from \c fileName in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param filename The file name from which to load the sub-image
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on center location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center of \c subImage in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on the center location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center location of the sub image from \c fileName in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseDown ( Display *displayLocation, int mouseButton );
|
||||
* \brief Press a mouse button down, and do not release it
|
||||
* \param displayLocation The Display of which to push a mouse button down
|
||||
* \param mouseButton The mouse button to push down
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseUp ( Display *displayLocation, int mouseButton );
|
||||
* \brief Release a mouse button
|
||||
* \param displayLocation The Display of which to release a mouse button
|
||||
* \param mouseButton The mouse button to release
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseJiggle ( Display *displayLocation );
|
||||
* \brief Jiggle the mouse in place
|
||||
* \details This moves the mouse down and right one pixel, and then back. This may be needed to activate menu items, etc.
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickKey ( Display *displayLocation, char *key );
|
||||
* \brief Press and release a keyboard key
|
||||
* \details This method allows you to press and release a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to click a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickKeyStr ( Display *displayLocation, char *string );
|
||||
* \brief Input a string of characters to the X Server
|
||||
* \details Instead of specifying a single character to enter at a time (\c 'a', \c 'Space') this function allows you to enter an entire string (\c 'Hello, World!') at a time.
|
||||
* \param displayLocation The Display of which to enter a key string on
|
||||
* \param string The key string to input to the X Server
|
||||
* \warning This function is currently unimplemented, but is on its way.
|
||||
*/
|
||||
|
||||
/** \fn void xte_keyDown ( Display *displayLocation, char *key );
|
||||
* \brief Press a key down, but do not release it
|
||||
* \details This method allows you to push down a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to push down a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn void xte_keyUp ( Display *displayLocation, char *key );
|
||||
* \brief Release a key
|
||||
* \details This method allows you to release a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to release a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Execute a command where the command is coming from a string
|
||||
* \details This function allows you to input a command to libcvautomation from a string. For example, to click a mouse button, you would use the \c command 'mouseclick'. Please note that some <tt>command</tt>s may need arguments to the string, and some may use function arguments. See \ref XTest_command_strings for a full list of command and arguments
|
||||
* \param displayLocation The Display of which to operate on
|
||||
* \param commandString The command string to execute - limit to \ref COMMAND_STR_LEN characters
|
||||
* \param mouseButton The mouse button to click if it is needed by the command being executed
|
||||
* \param searchMethod The search method to use if it is needed by the command being executed
|
||||
* \param tolerance The tolerance to use if it is needed by the command being executed
|
||||
* \see \ref XTest_command_strings
|
||||
* \see \ref libcv_search_methods
|
||||
*/
|
||||
|
@ -57,3 +57,26 @@ typedef struct {
|
||||
#include <libcvautomation/libcvautomation-xtest.h>
|
||||
|
||||
#endif /* LIBCVAUTOMATION_H */
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation.h
|
||||
* \brief The top-level include for all projects involving libcvautomation
|
||||
* \details This source file includes all other files needed for libcvautomation projects, and also defines the cvautomationList and cvaPoint structs to be used among libcvautomation functions. Please note that while the opencv2 version is being documented, there is no actual difference in usage for opencv version 1.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \struct cvautomationList
|
||||
* \brief Implements a structure to build an array for methods like matchSubImage_a()
|
||||
* \details This structure is a simple way to wrap up all needed information for matching sub images in one location.
|
||||
* \param cvaImage An image in IplImage format
|
||||
* \param fileName The file location of an image to be loaded
|
||||
* \param resultPoint Holder for a result - for example, storing where this sub image was located in its root image
|
||||
* \param searchMethod The search method to use when searching for this sub image in a root image
|
||||
* \param tolerance The tolerance to use when searching for this sub image in a root image
|
||||
* \see libcv_search_methods
|
||||
*/
|
||||
|
||||
/** \struct cvaPoint
|
||||
* \brief Very simple structure to standardize how points are used in libcvautomation
|
||||
* \param x An X-coordinate
|
||||
* \param y A Y-coordinate */
|
||||
|
@ -54,3 +54,144 @@ void matchSubImage_a_location ( const char *rootImageFileName, cvautomationList
|
||||
void matchSubImage_a_location_center ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_OPENCV_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-opencv.h
|
||||
* \brief The source code to access libcv from inside libcvautomation.
|
||||
* \details This source file builds in the necessary functionality to use libcv functions inside libcvautomation.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \page libcv_search_methods Libcv Search Methods
|
||||
This page describes the methods libcv uses to search for a sub image in a root image.
|
||||
\section SQDIFF Squared Difference
|
||||
\code #define CV_TM_SQDIFF 0 \endcode
|
||||
Squared Difference is the default search method used by \c libcvautomation, as well as \c cva-match and \c cva-input.
|
||||
\par For this method, setting a low tolerance value results in a more strict match.
|
||||
Formula:
|
||||
\f$R(x,y) = \sum_{x',y'} (T(x',y') - I(x + x', y+y'))^2 \f$
|
||||
|
||||
\section SQDIFF_NORMED Squared Difference (Normalized)
|
||||
\code #define CV_TM_SQDIFF_NORMED 1 \endcode
|
||||
This is a normalized version of the \ref SQDIFF search method.
|
||||
\par For this method, setting a low tolerance value results in a more strict match.
|
||||
Formula:
|
||||
\f$ R(x,y) = \frac{\sum_{x',y'}(T(x',y') - I(x + x', y + y'))^2}{ \sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'}I(x + x', y + y')^2}} \f$
|
||||
|
||||
\section CCORR Cross Correlation
|
||||
\code #define CV_TM_CCORR 2 \endcode
|
||||
This is the Cross Correlation search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y')) \f$
|
||||
|
||||
\section CCORR_NORMED Cross Correlation (Normalized)
|
||||
\code #define CV_TM_CCORR_NORMED 3 \endcode
|
||||
This is the normalized version of the \ref CCORR search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I'(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}} \f$
|
||||
|
||||
\section CCOEFF Correlation Coefficient
|
||||
\code #define CV_TM_CCOEFF 4 \endcode
|
||||
This is the Correlation Coefficient search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I(x+x',y+y')) \f$
|
||||
where:
|
||||
\f$ \begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array} \f$
|
||||
|
||||
\section CCOEFF_NORMED Correlation Coefficient (Normalized)
|
||||
\code #define CV_TM_CCOEFF_NORMED 5 \endcode
|
||||
This is the normalized version of the \ref CCOEFF search method.
|
||||
\par For this method, setting a high tolerance value results in a more strict match.
|
||||
|
||||
Formula:
|
||||
\f$ R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} } \f$
|
||||
*/
|
||||
|
||||
|
||||
/** \fn CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
* \brief Return the location of a sub image in its root image
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImage The sub image (in IplImage format) to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see \ref libcv_search_methods
|
||||
* \return The location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_center ( IplImage *rootImage, IplImage *subImage, int searchMethod, double tolerance );
|
||||
* \brief Return the center of a sub image in its root image, rather than the top-left corner
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImage The sub image (in IplImage format) to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The center location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_location ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
* \brief Return the location of a sub image in its root image
|
||||
* \details The difference that this function has over matchSubImage() is that \e rootImage_location and \e subImage_location are from files, rather than an IplImage format image.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImage_location The location of the sub image to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn CvPoint matchSubImage_location_center ( const char *rootImage_location, const char *subImage_location, int searchMethod, double tolerance );
|
||||
* \brief Return the center of a sub image in its root image, rather than the top-left corner
|
||||
* \details The difference that this function has over matchSubImage_center() is that \e rootImage_location and \e subImage_location are from files, rather than an IplImage format image.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImage_location The location of the sub image to search for in \c rootImage
|
||||
* \param searchMethod The search method to use when searching for \c subImage in \c rootImage.
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in \c rootImage.
|
||||
* \see libcv_search_methods
|
||||
* \return The center location of the sub image in root image
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage()
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImageArray The sub image array to search for in \c rootImage - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_center ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage_center()
|
||||
* \details Uses the cvautomationList.cvaImage parameter to find a \c subImage in \c rootImage
|
||||
* \param rootImage The root image (in IplImage format) to search in
|
||||
* \param subImageArray The sub image array to search for in \c rootImage - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_location ( const char *rootImage_location, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage()
|
||||
* \details The difference between this and matchSubImage_a() is that this uses a root image from filename, rather than from an IplImage format.
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImageArray The sub image array to search for in \c rootImage_location - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
||||
/** \fn void matchSubImage_a_location_center ( const char *rootImage_location, cvautomationList *subImageArray, int listSize );
|
||||
* \brief Parse an array of sub images and send them to matchSubImage_center()
|
||||
* \details The difference that this function has over matchSubImage_a_center() is that \c rootImage_location is from a file
|
||||
* \param rootImage_location The location of the root image
|
||||
* \param subImageArray The sub image array to search for in \c rootImage_location - Note that the contents of \c subImageArray are modified during execution of this routine
|
||||
* \param listSize The number of sub images to search for in subImageArray
|
||||
* \see cvautomationList
|
||||
* \return This function returns void, and modifies the contents of subImageArray
|
||||
*/
|
||||
|
@ -21,15 +21,6 @@
|
||||
|
||||
#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 );
|
||||
|
||||
@ -49,3 +40,70 @@ CvPoint matchSubImage_X11_location( Display *displayLocation, const char *subIma
|
||||
CvPoint matchSubImage_X11_location_center( Display *displayLocation, const char *subImage_location, int search_method, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XLIB_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-xlib.h
|
||||
* \brief The source code to access Xlib from inside libcvautomation
|
||||
* \details This source file builds in the necessary functionality to use libcv functions inside libcvautomation.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \fn Display* cvaOpenDisplay ( char *displayName );
|
||||
* \brief Simple wrapper for XOpenDisplay
|
||||
* \details Currently this function literally just passes off to XOpenDisplay, but is designed to be used in the future if extra functionality is needed.
|
||||
* \param displayName The name of the display to open - '' is a valid name
|
||||
* \returns Pointer to the opened X11 Display
|
||||
*/
|
||||
|
||||
/** \fn void cvaCloseDisplay ( Display *displayLocation );
|
||||
* \brief Simple wrapper for XCloseDisplay
|
||||
* \details Currently this function literally just passes off to XCloseDisplay, but is designed to be used in the future if extra functionality is needed.
|
||||
* \param displayLocation Pointer to the display to close
|
||||
* \returns Nothing
|
||||
*/
|
||||
|
||||
/** \fn CvPoint 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
|
||||
* \param subImage The sub image (in IplImage format) to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \returns The location of the sub image in root X11 window
|
||||
*/
|
||||
|
||||
/** \fn CvPoint 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
|
||||
* \param subImage The sub image (in IplImage format) to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \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 );
|
||||
* \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
|
||||
* \param subImage_location The location of the sub image to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \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 );
|
||||
* \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
|
||||
* \param subImage_location The location of the sub image to search for in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see libcv_search_methods
|
||||
* \returns The center location of the sub image in the root X11 window
|
||||
*/
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
#include <libcvautomation/libcvautomation.h>
|
||||
|
||||
#define IS_CMD( x, y ) strncmp( x, y, strlen( y ) ) == 0
|
||||
#define COMMAND_STR_LEN 512
|
||||
|
||||
/* Make sure that the XTest extension is supported.
|
||||
* If it's not, return 0 (false) */
|
||||
Bool xte_XTestSupported ( Display *displayLocation );
|
||||
@ -96,6 +99,539 @@ void xte_keyDown ( Display *displayLocation, char *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 );
|
||||
cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance );
|
||||
|
||||
#endif /* LIBCVAUTOMATION_XTEST_H */
|
||||
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation-xtest.h
|
||||
* \brief The source code to access the XTest extension inside libcvautomation
|
||||
* \details This source file builds in the necessary functionality to drive the X11 server in libcvautomation
|
||||
* \author Bradlee Speice
|
||||
* \date 6/26/2012
|
||||
*/
|
||||
|
||||
/** \page XTest_key_strings XTest Key Strings
|
||||
This page describes the various extra key strings to use with X11.
|
||||
The following list is generated with this command:
|
||||
\code xmodmap -pke | cut -d'=' -f2 | sed 's/ /\n/g' | tr -s '\n' | awk '{ print length(), $0 | "sort -n" }' | cut -d' ' -f2 | uniq \endcode
|
||||
\code
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
a
|
||||
A
|
||||
b
|
||||
B
|
||||
c
|
||||
C
|
||||
d
|
||||
D
|
||||
e
|
||||
E
|
||||
f
|
||||
F
|
||||
g
|
||||
G
|
||||
h
|
||||
H
|
||||
i
|
||||
I
|
||||
j
|
||||
J
|
||||
k
|
||||
K
|
||||
l
|
||||
L
|
||||
m
|
||||
M
|
||||
n
|
||||
N
|
||||
o
|
||||
O
|
||||
p
|
||||
P
|
||||
q
|
||||
Q
|
||||
r
|
||||
R
|
||||
s
|
||||
S
|
||||
t
|
||||
T
|
||||
u
|
||||
U
|
||||
v
|
||||
V
|
||||
w
|
||||
W
|
||||
x
|
||||
X
|
||||
y
|
||||
Y
|
||||
z
|
||||
Z
|
||||
at
|
||||
F1
|
||||
F2
|
||||
F3
|
||||
F4
|
||||
F5
|
||||
F6
|
||||
F7
|
||||
F8
|
||||
F9
|
||||
Up
|
||||
bar
|
||||
End
|
||||
F10
|
||||
F11
|
||||
F12
|
||||
Tab
|
||||
Down
|
||||
Home
|
||||
KP_0
|
||||
KP_1
|
||||
KP_2
|
||||
KP_3
|
||||
KP_4
|
||||
KP_5
|
||||
KP_6
|
||||
KP_7
|
||||
KP_8
|
||||
KP_9
|
||||
Left
|
||||
less
|
||||
Menu
|
||||
Next
|
||||
plus
|
||||
Alt_L
|
||||
Break
|
||||
colon
|
||||
comma
|
||||
equal
|
||||
grave
|
||||
KP_Up
|
||||
minus
|
||||
Pause
|
||||
Print
|
||||
Prior
|
||||
Right
|
||||
slash
|
||||
space
|
||||
aacute
|
||||
Aacute
|
||||
dagger
|
||||
Delete
|
||||
dollar
|
||||
eacute
|
||||
Eacute
|
||||
Escape
|
||||
exclam
|
||||
iacute
|
||||
Iacute
|
||||
Insert
|
||||
KP_Add
|
||||
KP_End
|
||||
Meta_L
|
||||
oacute
|
||||
Oacute
|
||||
period
|
||||
Return
|
||||
uacute
|
||||
Uacute
|
||||
greater
|
||||
Hyper_L
|
||||
KP_Down
|
||||
KP_Home
|
||||
KP_Left
|
||||
KP_Next
|
||||
percent
|
||||
Shift_L
|
||||
Shift_R
|
||||
Super_L
|
||||
Super_R
|
||||
Sys_Req
|
||||
XF86WWW
|
||||
asterisk
|
||||
KP_Begin
|
||||
KP_Enter
|
||||
KP_Equal
|
||||
KP_Prior
|
||||
KP_Right
|
||||
NoSymbol
|
||||
Num_Lock
|
||||
question
|
||||
quotedbl
|
||||
XF86Back
|
||||
XF86Mail
|
||||
XF86Stop
|
||||
XF86WLAN
|
||||
ampersand
|
||||
backslash
|
||||
BackSpace
|
||||
braceleft
|
||||
brokenbar
|
||||
Caps_Lock
|
||||
Control_L
|
||||
Control_R
|
||||
KP_Delete
|
||||
KP_Divide
|
||||
KP_Insert
|
||||
parenleft
|
||||
semicolon
|
||||
XF86Eject
|
||||
XF86Sleep
|
||||
adiaeresis
|
||||
Adiaeresis
|
||||
apostrophe
|
||||
asciitilde
|
||||
braceright
|
||||
ediaeresis
|
||||
Ediaeresis
|
||||
idiaeresis
|
||||
KP_Decimal
|
||||
numbersign
|
||||
odiaeresis
|
||||
Odiaeresis
|
||||
parenright
|
||||
udiaeresis
|
||||
Udiaeresis
|
||||
underscore
|
||||
XF86Reload
|
||||
XF86Search
|
||||
XF86WakeUp
|
||||
asciicircum
|
||||
bracketleft
|
||||
KP_Multiply
|
||||
KP_Subtract
|
||||
Mode_switch
|
||||
Scroll_Lock
|
||||
XF86Battery
|
||||
XF86Display
|
||||
XF86Forward
|
||||
XF86_Ungrab
|
||||
bracketright
|
||||
doubledagger
|
||||
ISO_Left_Tab
|
||||
XF86PowerOff
|
||||
XF86AudioMute
|
||||
XF86AudioNext
|
||||
XF86AudioPrev
|
||||
XF86AudioStop
|
||||
XF86Favorites
|
||||
XF86AudioMedia
|
||||
XF86AudioPause
|
||||
XF86Calculator
|
||||
XF86_ClearGrab
|
||||
XF86MyComputer
|
||||
XF86_Next_VMode
|
||||
XF86_Prev_VMode
|
||||
ISO_Level3_Shift
|
||||
Terminate_Server
|
||||
XF86_Switch_VT_1
|
||||
XF86_Switch_VT_2
|
||||
XF86_Switch_VT_3
|
||||
XF86_Switch_VT_4
|
||||
XF86_Switch_VT_5
|
||||
XF86_Switch_VT_6
|
||||
XF86_Switch_VT_7
|
||||
XF86_Switch_VT_8
|
||||
XF86_Switch_VT_9
|
||||
XF86KbdLightOnOff
|
||||
XF86_Switch_VT_10
|
||||
XF86_Switch_VT_11
|
||||
XF86_Switch_VT_12
|
||||
Pointer_EnableKeys
|
||||
XF86KbdBrightnessUp
|
||||
XF86MonBrightnessUp
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86KbdBrightnessDown
|
||||
XF86MonBrightnessDown
|
||||
\endcode
|
||||
\warning Please note that each key string above is first translated into a key code, and then into the actual key click. Thus, while you might intend to press "dollar", it will actually come out as "4".
|
||||
*/
|
||||
|
||||
/** \page XTest_command_strings xte_commandString() Command Strings
|
||||
This page describes the various command strings available for the \ref xte_commandString() function.
|
||||
\section mouseclick Mouse Click
|
||||
\code 'mouseclick <button_number>' \endcode
|
||||
Click the mouse button \c <button_number> in-place.
|
||||
\warning This command has no arguments.
|
||||
|
||||
\section imouseclick Image Mouse Click
|
||||
\code 'imouseclick <image_name>' \endcode
|
||||
Click the mouse at an image's top-left corner.
|
||||
|
||||
\section icmouseclick Image Mouse Click (Centered)
|
||||
\code 'icmouseclick <image_name>' \endcode
|
||||
Click the mouse at an image's center.
|
||||
|
||||
\section mousexy Mouse XY Move
|
||||
\code 'mousexy <x-coord> <y-coord>' \endcode
|
||||
Move the mouse to an absolute coordinate.
|
||||
\warning The \c <x-coord> and \c <y-coord> are expected to be integers.
|
||||
|
||||
\section mouserxy Mouse XY Move (Relative)
|
||||
\code 'mouserxy <x-increment> <y-increment>' \endcode
|
||||
Move the mouse by the given x and y values (relative motion).
|
||||
\par A positive X increment will move the mouse to the right, and a positive Y increment will move the mouse down.
|
||||
\warning The \c <x-increment> and \c <y-increment> are expected to be integers.
|
||||
|
||||
\section mouseimage Mouse Image Move
|
||||
\code 'mouseimage <image_name>' \endcode
|
||||
Move the mouse to an image's top-left corner.
|
||||
|
||||
\section cmouseimage Mouse Image Move (Centered)
|
||||
\code 'cmouseimage <image_name>' \endcode
|
||||
Move the mouse to an image's center.
|
||||
|
||||
\section mousedown Mouse Button Down
|
||||
\code 'mousedown <button_number>' \endcode
|
||||
Push and leave down a mouse button.
|
||||
|
||||
\section mouseup Mouse Button Up
|
||||
\code 'mouseup <button_number>' \endcode
|
||||
Release mouse button \c <button_number>
|
||||
|
||||
\section mousejiggle Mouse Jiggle
|
||||
\code 'mousejiggle' \endcode
|
||||
Jiggle the mouse (helps to activate some widgets). Moves the mouse right and down 1 pixel, and then back.
|
||||
|
||||
\section keyclick Key Button Click
|
||||
\code 'keyclick <key_name>' \endcode
|
||||
Push and release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keydown Key Button Down
|
||||
\code 'keydown <key_name>' \endcode
|
||||
Push down <em>but do not release</em> a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keyup Key Button Up
|
||||
\code 'keyup <key_name>' \endcode
|
||||
Release a keyboard key. This can be a key like \c 'a', \c 'b', or something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of special keys.
|
||||
|
||||
\section keystring Keyboard Input String
|
||||
\code 'keystring <string>' \endcode
|
||||
Input a string of text to the X11 server. For example, inputting 'Hello, world!" will act as if you typed 'Hello, world!' from the keyboard.
|
||||
\warning Unlike \ref keydown, \ref keyup, and \ref keyclick, this function can not handle special keys like 'Space'.
|
||||
*/
|
||||
|
||||
/** \def IS_CMD (x, y)
|
||||
* \brief Checks if string \c 'x' is in \c 'y'
|
||||
* \details Performs a safe check to see if x is in y - this way, you can check that \c "command" is inside \c "command argument"*/
|
||||
|
||||
/** \def COMMAND_STR_LEN
|
||||
* \brief Specifies the maximum length of a command string*/
|
||||
|
||||
/** \fn Bool xte_XTestSupported ( Display *displayLocation );
|
||||
* \brief Check if the XTest extension is supported
|
||||
* \param displayLocation The Display to check if XTest is supported on
|
||||
* \returns True if XTest is supported, False otherwise
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_pointerLocation ( Display *displayLocation );
|
||||
* \brief Grab the current location of the pointer
|
||||
* \param displayLocation The Display of which to grab the pointer location from
|
||||
* \returns cvaPoint with the current location of the pointer
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouse ( Display *displayLocation, int mouseButton );
|
||||
* \brief Click the mouse in its current location
|
||||
* \details Perform a mouse-down and mouse-up event on button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouseXY ( Display *displayLocation, int xLocation, int yLocation, int mouseButton );
|
||||
* \brief Click the mouse button at an absolute location
|
||||
* \details Move the mouse to location (\c xLocation, \c yLocation ) and then click button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param xLocation The X-coordinate to move the mouse to before clicking
|
||||
* \param yLocation The Y-location to move the mouse to before clicking
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement, int mouseButton );
|
||||
* \brief Click the mouse button at a relative location
|
||||
* \details Move the mouse horizontally \c xIncrement and vertically \c yIncrement before clicking button \c mouseButton
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param xIncrement Move the mouse horizontally this many pixels - positive value is motion to the right
|
||||
* \param yIncrement Move the mouse vertically this many pixels - positive value is motion downwards
|
||||
* \param mouseButton The mouse button to click
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding \c subImage in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on the location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the sub image from \c fileName in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on center location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center of \c subImage in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Click the mouse based on the center location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center location of the sub image from \c fileName in this display, moving the mouse to that location, and then clicking \c mouseButton. The return value can be ignored, the mouse will already have been clicked there.
|
||||
* \param displayLocation The Display of which to click the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param mouseButton The mouse button to click
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was clicked. This will be (-1,-1) if there was an error, in which case the mouse will not have been clicked.
|
||||
*/
|
||||
|
||||
/** \fn void xte_hoverMouseXY ( Display *displayLocation, int xLocation, int yLocation );
|
||||
* \brief Move the mouse to a location, but do not click it
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
* \param xLocation The X-coordinate of which to move the mouse
|
||||
* \param yLocation The Y-coordinate of which to move the mouse
|
||||
*/
|
||||
|
||||
/** \fn void xte_hoverMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement );
|
||||
* \brief Move the mouse to a relative location, but do not click it
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
* \param xIncrement How far to move the mouse horizontally. Positive values indicate motion to the right.
|
||||
* \param yIncrement How far to move the mouse vertically. Positive values indicate motion downward.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding \c subImage in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *filename, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the sub image from \c fileName in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param filename The file name from which to load the sub-image
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on center location of an image
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center of \c subImage in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param subImage The sub image (in IplImage format) to find in the root X11 window
|
||||
* \param searchMethod The search method to use when searching for \c subImage in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for \c subImage in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance );
|
||||
* \brief Move the mouse based on the center location of an image from file
|
||||
* \details Wraps grabbing the X11 root window of \c displayLocation, finding the center location of the sub image from \c fileName in this display, and then moving the mouse to that location. The return value can be ignored, the mouse will already have been moved there.
|
||||
* \param displayLocation The Display of which to move the mouse on
|
||||
* \param fileName The file name from which to load the sub-image
|
||||
* \param searchMethod The search method to use when searching for the sub image in the root X11 window
|
||||
* \param tolerance The tolerance to use when searching for the sub image in the root X11 window
|
||||
* \see \ref libcv_search_methods
|
||||
* \returns The location of where the mouse was moved. This will be (-1,-1) if there was an error, in which case the mouse will not have been moved.
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseDown ( Display *displayLocation, int mouseButton );
|
||||
* \brief Press a mouse button down, and do not release it
|
||||
* \param displayLocation The Display of which to push a mouse button down
|
||||
* \param mouseButton The mouse button to push down
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseUp ( Display *displayLocation, int mouseButton );
|
||||
* \brief Release a mouse button
|
||||
* \param displayLocation The Display of which to release a mouse button
|
||||
* \param mouseButton The mouse button to release
|
||||
*/
|
||||
|
||||
/** \fn void xte_mouseJiggle ( Display *displayLocation );
|
||||
* \brief Jiggle the mouse in place
|
||||
* \details This moves the mouse down and right one pixel, and then back. This may be needed to activate menu items, etc.
|
||||
* \param displayLocation The Display of which to move the mouse
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickKey ( Display *displayLocation, char *key );
|
||||
* \brief Press and release a keyboard key
|
||||
* \details This method allows you to press and release a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to click a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn void xte_clickKeyStr ( Display *displayLocation, char *string );
|
||||
* \brief Input a string of characters to the X Server
|
||||
* \details Instead of specifying a single character to enter at a time (\c 'a', \c 'Space') this function allows you to enter an entire string (\c 'Hello, World!') at a time.
|
||||
* \param displayLocation The Display of which to enter a key string on
|
||||
* \param string The key string to input to the X Server
|
||||
* \warning This function is currently unimplemented, but is on its way.
|
||||
*/
|
||||
|
||||
/** \fn void xte_keyDown ( Display *displayLocation, char *key );
|
||||
* \brief Press a key down, but do not release it
|
||||
* \details This method allows you to push down a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to push down a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn void xte_keyUp ( Display *displayLocation, char *key );
|
||||
* \brief Release a key
|
||||
* \details This method allows you to release a key, where the key may be \c 'a', \c 'b', or maybe something fancy like \c 'Space'. Please see \ref XTest_key_strings for a full list of keys.
|
||||
* \param displayLocation The Display of which to release a key
|
||||
* \param key The key to click as a string
|
||||
* \see \ref XTest_key_strings
|
||||
*/
|
||||
|
||||
/** \fn cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance );
|
||||
* \brief Execute a command where the command is coming from a string
|
||||
* \details This function allows you to input a command to libcvautomation from a string. For example, to click a mouse button, you would use the \c command 'mouseclick'. Please note that some <tt>command</tt>s may need arguments to the string, and some may use function arguments. See \ref XTest_command_strings for a full list of command and arguments
|
||||
* \param displayLocation The Display of which to operate on
|
||||
* \param commandString The command string to execute - limit to \ref COMMAND_STR_LEN characters
|
||||
* \param mouseButton The mouse button to click if it is needed by the command being executed
|
||||
* \param searchMethod The search method to use if it is needed by the command being executed
|
||||
* \param tolerance The tolerance to use if it is needed by the command being executed
|
||||
* \see \ref XTest_command_strings
|
||||
* \see \ref libcv_search_methods
|
||||
*/
|
||||
|
@ -59,3 +59,26 @@ typedef struct {
|
||||
#include <libcvautomation/libcvautomation-xtest.h>
|
||||
|
||||
#endif /* LIBCVAUTOMATION_H */
|
||||
/* Doxygen information */
|
||||
/** \file libcvautomation.h
|
||||
* \brief The top-level include for all projects involving libcvautomation
|
||||
* \details This source file includes all other files needed for libcvautomation projects, and also defines the cvautomationList and cvaPoint structs to be used among libcvautomation functions. Please note that while the opencv2 version is being documented, there is no actual difference in usage for opencv version 1.
|
||||
* \author Bradlee Speice
|
||||
* \date 6/21/2012
|
||||
*/
|
||||
|
||||
/** \struct cvautomationList
|
||||
* \brief Implements a structure to build an array for methods like matchSubImage_a()
|
||||
* \details This structure is a simple way to wrap up all needed information for matching sub images in one location.
|
||||
* \param cvaImage An image in IplImage format
|
||||
* \param fileName The file location of an image to be loaded
|
||||
* \param resultPoint Holder for a result - for example, storing where this sub image was located in its root image
|
||||
* \param searchMethod The search method to use when searching for this sub image in a root image
|
||||
* \param tolerance The tolerance to use when searching for this sub image in a root image
|
||||
* \see libcv_search_methods
|
||||
*/
|
||||
|
||||
/** \struct cvaPoint
|
||||
* \brief Very simple structure to standardize how points are used in libcvautomation
|
||||
* \param x An X-coordinate
|
||||
* \param y A Y-coordinate */
|
||||
|
@ -170,7 +170,7 @@ void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int
|
||||
* searchMethod and threshold value.
|
||||
* =====================================================================================
|
||||
*/
|
||||
void matchSubImage_a_location ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize )
|
||||
void matchSubImage_a_location ( const char *rootImage_location, cvautomationList *subImageArray, int listSize )
|
||||
{
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
@ -179,7 +179,7 @@ void matchSubImage_a_location ( const char *rootImageFileName, cvautomationList
|
||||
cvautomationList curr;
|
||||
|
||||
IplImage *rootImage;
|
||||
rootImage = cvLoadImage( rootImageFileName, CV_LOAD_IMAGE_COLOR );
|
||||
rootImage = cvLoadImage( rootImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
int x = 0;
|
||||
for ( x = 0; x < listSize; x++ )
|
||||
@ -383,7 +383,7 @@ void matchSubImage_a_center ( IplImage *rootImage, cvautomationList *subImageArr
|
||||
* image, rather than the top-left corner.
|
||||
* =====================================================================================
|
||||
*/
|
||||
void matchSubImage_a_location_center ( const char *rootImageFileName, cvautomationList *subImageArray, int listSize )
|
||||
void matchSubImage_a_location_center ( const char *rootImage_location, cvautomationList *subImageArray, int listSize )
|
||||
{
|
||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||
* at making python support for multiple images very easy. */
|
||||
@ -392,7 +392,7 @@ void matchSubImage_a_location_center ( const char *rootImageFileName, cvautomati
|
||||
cvautomationList curr;
|
||||
|
||||
IplImage *rootImage;
|
||||
rootImage = cvLoadImage( rootImageFileName, CV_LOAD_IMAGE_COLOR );
|
||||
rootImage = cvLoadImage( rootImage_location, CV_LOAD_IMAGE_COLOR );
|
||||
|
||||
int x = 0;
|
||||
for ( x = 0; x < listSize; x++ )
|
||||
|
@ -18,9 +18,6 @@
|
||||
|
||||
#include <libcvautomation/libcvautomation-xtest.h>
|
||||
|
||||
#define IS_CMD( x, y ) strncmp( x, y, strlen( y ) ) == 0
|
||||
#define COMMAND_STR_LEN 512
|
||||
|
||||
/* Note: The XLib documentation says that we shouldn't need to XFlush,
|
||||
* but I've found in testing that events don't get done correctly unless
|
||||
* we do. I've included the XFlush() calls. */
|
||||
@ -498,8 +495,6 @@ void xte_mouseJiggle ( Display *displayLocation )
|
||||
*/
|
||||
void xte_clickKey ( Display *displayLocation, char *key )
|
||||
{
|
||||
/* Part of this code based on xte from the xautomation source
|
||||
* available at http://hoopajoo.net/projects/xautomation.html */
|
||||
KeyCode kc;
|
||||
KeySym ks;
|
||||
|
||||
@ -737,3 +732,4 @@ cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int
|
||||
|
||||
return resultPoint;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user