We are having some problems with imaqFitEllipse function from imaq vision 6.0
The problem consist of a change of the returning data of the imaqFitEllipse function depending if we are runing the
executable (release or debug) from the compiler (shift+F5 in Labwindows and F5 in visual Studio) or if we are running
the executable alone (from windows explorer or ctrl+F5 in VS and labwindows).
CASE 1: Runing the executable (release or debug) from the compiler (shift+F5 in Labwindows and F5 in visual Studio)
when we run the executable from the compiler, the function works properly and returns the correct values:
MajorAxis: 45.0014 MinorAxis: 39.9980.
CASE 2: running the executable alone (from windows explorer or ctrl+F5 in VS and labwindows).
when we run this code "alone" or with ctrl+F5, the code does not work properly, and the ellipse fitting is not well
calculated.
In same computers it returns the same data from the two axis (as the ellipse were a circle)
MajorAxis: 42.5735 MinorAxis: 42.5735
(AMD 1800+, Windows XP SP2)
(DELL PIV 2800 Windows XP SP2)
In other computers, if we call imaqFitEllipse function with different values (different radios) it return
different ellipse estimation depending on the order we call the functions (inizalization and Local maximum error??)
(DELL PIV 2600 Windows 2000 SP??)
And in some other computers the function work OK, as in the CASE 1
(Compaq EVO PIVMobile 1.6 Windows 2000 SP4)
The versions of the imaq software on the diferent computers are the same.
In the CASE 1 conditions the function works OK in all the computers
Here you have the code we have created to test the function.
Thank you in advance
Artzai Picon
#define Pi 3.1415926535
void CPruebaEllipseDlg::OnBnClickedButton1()
{
PointFloat P[256];
int i;
BestEllipse DatosElipse;
char cadena[200];
double DistEjeMayor,DistEjeMenor;
double r1=40.0;
double r2=45.0;
//We Generate a Ellipse
for (i=0;i<256;i++)
{
P[i].x= r1*cos(Pi*2*i/256);
P[i].y= r2*sin(Pi*2*i/256);
}
//We call imaqFitEllipse function
imaqFitEllipse(P,256,&DatosElipse);
//Es calculate Major and Minor axis length
DistEjeMayor=((DatosElipse.majorAxisStart.x-DatosElipse.majorAxisEnd.x)*(DatosElipse.majorAxisStart.x-DatosElipse.majorAxisEnd.x));
DistEjeMayor+=((DatosElipse.majorAxisStart.y-DatosElipse.majorAxisEnd.y)*(DatosElipse.majorAxisStart.y-DatosElipse.majorAxisEnd.y));
DistEjeMayor=sqrt(DistEjeMayor);
DistEjeMenor=((DatosElipse.minorAxisStart.x-DatosElipse.minorAxisEnd.x)*(DatosElipse.minorAxisStart.x-DatosElipse.minorAxisEnd.x));
DistEjeMenor+=((DatosElipse.minorAxisStart.y-DatosElipse.minorAxisEnd.y)*(DatosElipse.minorAxisStart.y-DatosElipse.minorAxisEnd.y));
DistEjeMenor=sqrt(DistEjeMenor);
sprintf(cadena,"E1=%.4f E2=%.4f", DistEjeMayor/2, DistEjeMenor/2);
//LABWINDOWS
//MessagePopup ("Elipse",cadena);
//Visual Studio
MessageBox (cadena,"Elipse");
}
Mensaje editado por Artzai