mirror of
				https://github.com/bspeice/libcvautomation
				synced 2025-11-04 02:10:35 -05:00 
			
		
		
		
	Put in a warning about using waitfor without a tolerance value
This commit is contained in:
		@ -802,6 +802,19 @@ cvaPoint xte_waitForImage_location ( Display *displayLocation, const char *fileN
 | 
			
		||||
	cvaPoint resultPoint;
 | 
			
		||||
	resultPoint.x = resultPoint.y = -1;
 | 
			
		||||
 | 
			
		||||
	/* The next conditional bears some discussion. Due to the way template matching works,
 | 
			
		||||
	 * if the tolerance is INT_MAX or INT_MIN (depending on the search method) you will
 | 
			
		||||
	 * *always* get a result back. Thus, while your intentions may be good, you kill
 | 
			
		||||
	 * the point of waiting until an image appears. Please tune your tolerance values. */
 | 
			
		||||
	if ((searchMethod == CV_TM_SQDIFF && tolerance == INT_MAX) ||
 | 
			
		||||
		(searchMethod == CV_TM_SQDIFF_NORMED && tolerance == INT_MAX) ||
 | 
			
		||||
		(searchMethod == CV_TM_CCORR && tolerance == INT_MIN) ||
 | 
			
		||||
		(searchMethod == CV_TM_CCORR_NORMED && tolerance == INT_MIN) ||
 | 
			
		||||
		(searchMethod == CV_TM_CCOEFF && tolerance == INT_MIN) ||
 | 
			
		||||
		(searchMethod == CV_TM_CCOEFF_NORMED && tolerance == INT_MIN) )
 | 
			
		||||
		
 | 
			
		||||
		fprintf( stderr, "Passing a bad tolerance value to xte_waitForImage_location()...\n" );
 | 
			
		||||
 | 
			
		||||
	int localTime = 0;
 | 
			
		||||
	while ( localTime < timeout )
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user