10-29-2013 07:07 AM
I have an older application initially developed and running on the client setup on WinXP and using Vision 8.2, but after switching both my development station and client setup to Win7 and Vision 2010, it always crashes inside the imaqDetectCircles functions with General Protection fault.
I cannot see any difference in the parameter structure or format of the function between Vision module versions, so does anyone know if the function is no longer supported and what alternate to use?
Here is a snipet with just the relevant code:
Image *pImageU8=NULL; CircleDescriptor *pSpotDescriptor=NULL; CurveOptions *pCurveOptions=NULL; CircleMatch *pCirclesFound=NULL; int iCirclesFound=0; // cast image to 8 bit pImageU8 = imaqCreateImage(IMAQ_IMAGE_U8,9); imaqCast(pImageU8, g_pImage, IMAQ_IMAGE_U8, NULL, g_iImageBitDepth-8); // prepare & start circles detection pSpotDescriptor = malloc(sizeof(CircleDescriptor)); pSpotDescriptor->minRadius = g_iCircle_MinRadius; pSpotDescriptor->maxRadius = g_iCircle_MaxRadius; pCurveOptions = malloc(sizeof(CurveOptions)); pCurveOptions->extractionMode = g_iCurve_ExtractionMode; pCurveOptions->threshold = g_iCurve_Threshold; pCurveOptions->filterSize = g_iCurve_FilterSize; pCurveOptions->minLength = g_iCurve_MinLength; pCurveOptions->rowStepSize = g_iCurve_RowStepSize; pCurveOptions->columnStepSize = g_iCurve_ColumnStepSize; pCurveOptions->maxEndPointGap = g_iCurve_MaxEndPointGap; pCurveOptions->onlyClosed = g_iCurve_OnlyClosed; pCurveOptions->subpixelAccuracy = g_iCurve_SubPixelAccuracy; pCirclesFound = imaqDetectCircles (pImageU8, pSpotDescriptor, pCurveOptions, NULL, NULL, &iCirclesFound);
10-30-2013 10:01 AM
Hi Octavian84,
1) What software and version are you using to run this application?
2) What version of IMAQ are you using? This is listed in NI-MAX under Software.
3) Are you acquiring images from our hardware? If so, what framegrabber are you using?
4) Do you get an error code for the General Protection Fault? A screenshot of the full error may help to narrow down what is causing this issue.
According to the current documentation, I don't see anything wrong with the way you're implementing this function:
Searches for circles in an image.
Image Types Supported
IMAQ_IMAGE_U8
/*-------------------- Prototype ---------------------*/
CircleMatch *imaqDetectCircles (const Image *Image,
const CircleDescriptor
*Circle_Descriptor,
const CurveOptions
*Curve_Options,
const ShapeDetectionOptions
*Shape_Detection_Options,
const ROI *Roi,
int *Num_Matches_Returned);
Please post again with your versions and error code, and I can research what may be causing this behavior.
Thanks!
10-31-2013 02:22 AM - edited 10-31-2013 02:23 AM
Hi Emily,
1) Labwindows CVI 2010 v10.0.0.360
2) Ni Vision v10.0.0.49152
3) No, the images are provided by a different setup in tif format. I've attached one.
4) No specific error code. I can't use imaqGetLastError since it doesn't go past the circle detect function even with Break on Library Error unchecked.
10-31-2013 03:44 PM
Hi Octavian84,
It looks like this may be related to a known issue when upgrading from 8.5 to some newer versions. I'm looking into this, but could you please try setting the ROI to a value other than NULL and let me know what happens?
Thanks!
11-01-2013 06:04 AM
I didn't consider it, since the function help states to pass NULL to search on full image, but specifying the ROI seems to have fixed the issue.
Thanks.
11-01-2013 03:57 PM