mirror of
https://github.com/bspeice/libcvautomation
synced 2025-04-21 00:41:29 -04:00
Fix matchSubImage_a not using the proper call to matchSubImage
Refactoring changes - use an array instead of a linked list - if you want a linked list, you can do it yourself, reference code is in cva-match.c Fix some build errors - not all function prototypes could see the cvautomationList struct.
This commit is contained in:
parent
a63c54f9c4
commit
0a10dc798c
@ -126,13 +126,13 @@ CvPoint matchSubImage_location ( char *rootImage_location, char *subImage_locati
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* === FUNCTION ======================================================================
|
* === FUNCTION ======================================================================
|
||||||
* Name: matchSubImage_list
|
* Name: matchSubImage_a
|
||||||
* Description: Match a root image and sub image from a list of sub-images.
|
* Description: Match a root image and sub image from an array of sub-images.
|
||||||
* The list contains an element for each sub-image to specify its own
|
* The list contains an element for each sub-image to specify its own
|
||||||
* searchMethod and threshold value.
|
* searchMethod and threshold value.
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
void matchSubImage_list ( IplImage *rootImage, cvautomationList *subImageListHead, int listSize )
|
void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int listSize )
|
||||||
{
|
{
|
||||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||||
* at making python support for multiple images very easy. */
|
* at making python support for multiple images very easy. */
|
||||||
@ -143,11 +143,19 @@ void matchSubImage_list ( IplImage *rootImage, cvautomationList *subImageListHea
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
for ( x = 0; x < listSize; x++ )
|
for ( x = 0; x < listSize; x++ )
|
||||||
{
|
{
|
||||||
curr = subImageList[x];
|
curr = subImageArray[x];
|
||||||
if ( subImageListHead[x].cvaImage != 0 )
|
if ( subImageArray[x].cvaImage != 0 )
|
||||||
resultPoint = matchSubImage ( rootImage, curr.cvaImage, curr.searchMethod, curr.tolerance );
|
resultPoint = matchSubImage ( rootImage, curr.cvaImage, curr.searchMethod, curr.tolerance );
|
||||||
else
|
else
|
||||||
resultPoint = matchSubImage ( rootImage, curr.fileName, curr.searchMethod, curr.tolerance );
|
{
|
||||||
|
/* We have a sub-image filename, go ahead and create the actual image. */
|
||||||
|
IplImage *subImage;
|
||||||
|
subImage = cvLoadImage( curr.fileName, CV_LOAD_IMAGE_COLOR );
|
||||||
|
|
||||||
|
resultPoint = matchSubImage ( rootImage, subImage, curr.searchMethod, curr.tolerance );
|
||||||
|
|
||||||
|
cvReleaseImage( &subImage );
|
||||||
|
}
|
||||||
|
|
||||||
curr.resultPoint = resultPoint;
|
curr.resultPoint = resultPoint;
|
||||||
}
|
}
|
||||||
@ -157,12 +165,12 @@ void matchSubImage_list ( IplImage *rootImage, cvautomationList *subImageListHea
|
|||||||
* === FUNCTION ======================================================================
|
* === FUNCTION ======================================================================
|
||||||
* Name: matchSubImage_list_location
|
* Name: matchSubImage_list_location
|
||||||
* Description: Match a root image from location, and sub image from
|
* Description: Match a root image from location, and sub image from
|
||||||
* a list of sub-images.
|
* an array of sub-images.
|
||||||
* The list contains an element for each sub-image to specify its own
|
* The list contains an element for each sub-image to specify its own
|
||||||
* searchMethod and threshold value.
|
* searchMethod and threshold value.
|
||||||
* =====================================================================================
|
* =====================================================================================
|
||||||
*/
|
*/
|
||||||
void matchSubImage_list ( char *rootImageFileName, cvautomationList *subImageListHead, int listSize )
|
void matchSubImage_a_location ( char *rootImageFileName, cvautomationList *subImageArray, int listSize )
|
||||||
{
|
{
|
||||||
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
/* This is also a higher-end wrapper for matchSubImage, but is mostly aimed
|
||||||
* at making python support for multiple images very easy. */
|
* at making python support for multiple images very easy. */
|
||||||
@ -171,18 +179,28 @@ void matchSubImage_list ( char *rootImageFileName, cvautomationList *subImageLis
|
|||||||
cvautomationList curr;
|
cvautomationList curr;
|
||||||
|
|
||||||
IplImage *rootImage;
|
IplImage *rootImage;
|
||||||
rootImage = cvLoadImage ( rootImageFileName, CV_LOAD_IMAGE_COLOR );
|
rootImage = cvLoadImage( rootImageFileName, CV_LOAD_IMAGE_COLOR );
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for ( x = 0; x < listSize; x++ )
|
for ( x = 0; x < listSize; x++ )
|
||||||
{
|
{
|
||||||
curr = subImageList[x];
|
curr = subImageArray[x];
|
||||||
if ( subImageListHead[x].cvaImage != 0 )
|
if ( subImageArray[x].cvaImage != 0 )
|
||||||
resultPoint = matchSubImage ( rootImage, curr.cvaImage, curr.searchMethod, curr.tolerance );
|
resultPoint = matchSubImage ( rootImage, curr.cvaImage, curr.searchMethod, curr.tolerance );
|
||||||
else
|
else
|
||||||
resultPoint = matchSubImage ( rootImage, curr.fileName, curr.searchMethod, curr.tolerance );
|
{
|
||||||
|
/* We have a sub-image filename, go ahead and create the actual image. */
|
||||||
|
IplImage *subImage;
|
||||||
|
subImage = cvLoadImage( curr.fileName, CV_LOAD_IMAGE_COLOR );
|
||||||
|
|
||||||
|
resultPoint = matchSubImage ( rootImage, subImage, curr.searchMethod, curr.tolerance );
|
||||||
|
|
||||||
|
cvReleaseImage( &subImage );
|
||||||
|
}
|
||||||
|
|
||||||
curr.resultPoint = resultPoint;
|
curr.resultPoint = resultPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cvReleaseImage( &rootImage );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@ CvPoint matchSubImage ( IplImage *rootImage, IplImage *subImage, int searchMetho
|
|||||||
/* Match a root image and sub image from filename */
|
/* Match a root image and sub image from filename */
|
||||||
CvPoint matchSubImage_location ( char *rootImage_location, char *subImage_location, int searchMethod, double tolerance );
|
CvPoint matchSubImage_location ( char *rootImage_location, char *subImage_location, int searchMethod, double tolerance );
|
||||||
|
|
||||||
/* Match a root image and sub images from a list of images */
|
/* Match a root image and sub images from an array of images */
|
||||||
void matchSubImage_list ( IplImage *rootImage, cvautomationList *subImageListHead, int listSize )
|
void matchSubImage_a ( IplImage *rootImage, cvautomationList *subImageArray, int listSize );
|
||||||
|
|
||||||
|
/* Match a root image and sub images from an array of images */
|
||||||
|
void matchSubImage_a_location ( char *rootImageFileName, cvautomationList *subImageArray, int listSize );
|
||||||
|
|
||||||
#endif /* LIBCVAUTOMATION_OPENCV_H */
|
#endif /* LIBCVAUTOMATION_OPENCV_H */
|
||||||
|
@ -18,11 +18,14 @@
|
|||||||
#ifndef LIBCVAUTOMATION_H
|
#ifndef LIBCVAUTOMATION_H
|
||||||
#define LIBCVAUTOMATION_H
|
#define LIBCVAUTOMATION_H
|
||||||
|
|
||||||
|
/* C includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* OpenCV includes */
|
||||||
#include <opencv/cv.h>
|
#include <opencv/cv.h>
|
||||||
#include <opencv/highgui.h>
|
#include <opencv/highgui.h>
|
||||||
|
|
||||||
|
/* X11 includes */
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
@ -39,4 +42,10 @@ typedef struct {
|
|||||||
|
|
||||||
} cvautomationList;
|
} cvautomationList;
|
||||||
|
|
||||||
|
/* Project component includes */
|
||||||
|
/* The includes come here to make sure all function prototypes have access
|
||||||
|
* to the cvautomationList struct */
|
||||||
|
#include "libcvautomation-opencv.h"
|
||||||
|
#include "libcvautomation-x11.h"
|
||||||
|
|
||||||
#endif /* LIBCVAUTOMATION_H */
|
#endif /* LIBCVAUTOMATION_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user