Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do i get the goodness of fit for the result of fitEllipse?

//fit an ellipse and get goodness of fit rRect = fitEllipse( Coords);

double angle = rRect.angle/180*Pi; Point2f Center = rRect.center; Size2f Sz = rRect.size;

g_GOF = 0; //Goodness Of Fit, the smaller the better double posx, posy; for(int i = 0; i < 32; i++){ posx = (Coords[i].x - Center.x) * cos(-angle) - (Coords[i].y- Center.y) * sin(-angle); posy = (Coords[i].x - Center.x) * sin(-angle) + (Coords[i].y- Center.y) * cos(-angle); g_GOF += abs( posx/Sz.widthposx/Sz.width + posy/Sz.heightposy/Sz.height - 0.25); }

//this works very well but comments are appreciated

How do i get the goodness of fit for the result of fitEllipse?

//fit an ellipse and get goodness of fit fit

rRect = fitEllipse( Coords);

Coords);

double angle = rRect.angle/180*Pi; Point2f Center = rRect.center; Size2f Sz = rRect.size;

rRect.size;

g_GOF = 0; //Goodness Of Fit, the smaller the better double posx, posy; for(int i = 0; i < 32; i++){ posx = (Coords[i].x - Center.x) * cos(-angle) - (Coords[i].y- Center.y) * sin(-angle); posy = (Coords[i].x - Center.x) * sin(-angle) + (Coords[i].y- Center.y) * cos(-angle); g_GOF += abs( posx/Sz.widthposx/Sz.width posx/Sz.width*posx/Sz.width + posy/Sz.heightposy/Sz.height posy/Sz.height*posy/Sz.height - 0.25); }

}

//this works very well but comments are appreciated

How do i get the goodness of fit for the result of fitEllipse?

//fit fit an ellipse and get goodness of fit

rRect = fitEllipse( Coords);

double angle = rRect.angle/180*Pi;
Point2f Center = rRect.center;
Size2f Sz = rRect.size;

g_GOF = 0; //Goodness Of Fit, the smaller the better
double posx, posy;
for(int i = 0; i < 32; i++){
    posx = (Coords[i].x - Center.x) * cos(-angle) - (Coords[i].y- Center.y) * sin(-angle);
    posy = (Coords[i].x - Center.x) * sin(-angle) + (Coords[i].y- Center.y) * cos(-angle);
    g_GOF += abs( posx/Sz.width*posx/Sz.width + posy/Sz.height*posy/Sz.height - 0.25);
}

//this this works very well but comments are appreciated