07-25-2005 05:17 PM
07-26-2005 04:18 PM
07-26-2005 04:27 PM
07-29-2005 01:14 PM
Hello,
My understanding is that your code is functioning properly, but the functions are all returning 0 values. In the documentation, it is stated that a return value of 0 corresponds to an error. However, attempting to determine the error type generates a message which indicates that no error has occurred.
Is that accurate? I will investigate those functions and determine what value should be returned. I will let you know when I find out if the problem is with the code or with the documentation. Have you tried to force an error in your code to determine if a non-zero value is returned in that case?
Regards,
Scott R.
Applications Engineer
National Instruments
07-29-2005 01:36 PM
The only function I have found up to now returning a 0 on success, is imaqFindTransformPattern(). Then I use imaqGetLastError(), and it returns "No Error". All other functions I am using return non-zero values on success, which is what I expect.
And yes, I have forced errors in the code. As I mentioned before, only imaqFindTransformPattern() returns 0 both on success and on failure. That is weird.
08-04-2005 11:48 AM
08-04-2005 12:09 PM
Hi,
This is an example of the code I am running. GrayscaleImage is an IMAQ_IMAGE_U8 image. CoordinateSystemPatternImage is an IMAQ_IMAGE_U8 image used as the reference for the coordinate system. AppFindTransformPatternOptions consists of the following:
AppFindTransformPatternOptions.matchMode = IMAQ_MATCH_ROTATION_INVARIANT; // Look for rotated images
AppFindTransformPatternOptions.minMatchScore = MIN_SCORE; // 500
AppFindTransformPatternOptions.subpixelAccuracy = TRUE;
AppFindTransformPatternOptions.angleRanges = &Angles; // I set it from -45 to 45 degrees
AppFindTransformPatternOptions.numRanges = 1;
AppFindTransformPatternOptions.showSearchArea = FALSE;
AppFindTransformPatternOptions.showFeatureFound = TRUE;
AppFindTransformPatternOptions.showResult = TRUE;
if ((imaqFindTransformPattern(GrayscaleImage, CoordinateSystemPatternImage, &CoordSystem, IMAQ_NO_ROTATED_RECT, IMAQ_UPDATE_TRANSFORM, &AppFindTransformPatternOptions, NULL)) == 0){
Error = imaqGetLastError();
ErrorString = imaqGetErrorText(Error);
if (Error)
MessagePopup("Error", ErrorString);
imaqDispose(ErrorString);
}
On success, this function returns 0. That IS NOT what the documentation says. However, the function is doing what is supposed to.