Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Incorrect Results from imaqCircles Using IMAQ Vision 6.0

Primary Software: LabWindows/CVI Add-ons>>Vision Development Module
Primary Software Version: 6.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: I am using Vision Assistant 7.0 and added a circle detection step to my script. In my image, I detect 1 circle in my specified range. When I create my builder file and use that code in CVI, I detect many circles and the results for x, y, and radius are different from the circle found in Vision Assistant. Part of my CVI code looks like this:

Report = imaqCircles(circleImage, threshImage, 50, 65536, &numCircles);
x = Report->center.x;
y = Report->.center.y;
r = Report->radius;


Solution: The function for circle detection has been improved from Vision 6.0 to Vision 7.0. The improved circle detection in Vision 7.0 will return the number of circles that fall within the radius range specified. With Vision 6.0, the imaqCircles function will return all of the circles found, even if the radius is not within the range specified. The range only filters what circles are drawn on the image. In Vision Assistant, reduce the minimum radius of the Circle Detection step to 1. You will see all of the circles that can be found in the image.

The output of the imaqCircles function, CircleReport*, is an array of reports because one report is created for each circle found. This is explained in the Vision 6.0 for LabWindows/CVI function reference:

"CircleReport*-On success, this function returns an array of structures containing information about each of the found circles. On failure, this function returns NULL."

CircleReport* is a pointer to a struct. Typically to get information from a pointer to a struct, you would use the -> notation, but the imaqCircle function returns an array of reports. If you use the ->, you will only get information about the first circle found. Since pointers and arrays are treated similarly in memory, you access the struct as an array, for example:

x = Report[5].center.x;
y = Report[5].center.y;
r = Report[5].radius;

Please refer to the Vision 6.0 for LabWindows/CVI function reference for more information about imaqCircles and other functions.

Related Links:
National Instruments Image Acquisition and Vision Support Homepage

Attachments:





Report Date: 04/30/2004
Last Updated: 05/21/2004
Document ID: 38T94IMU

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit