MCPcopy Create free account
hub / github.com/creatale/node-dv / icvFitLine3D

Function icvFitLine3D

deps/opencv/modules/imgproc/src/linefit.cpp:487–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485(D, E, F) is the point that belongs to the line. */
486
487static CvStatus
488icvFitLine3D( CvPoint3D32f * points, int count, int dist,
489 float _param, float reps, float aeps, float *line )
490{
491 double EPS = count*FLT_EPSILON;
492 void (*calc_weights) (float *, int, float *) = 0;
493 void (*calc_weights_param) (float *, int, float *, float) = 0;
494 float *w; /* weights */
495 float *r; /* square distances */
496 int i, j, k;
497 float _line[6]={0,0,0,0,0,0}, _lineprev[6]={0,0,0,0,0,0};
498 float rdelta = reps != 0 ? reps : 1.0f;
499 float adelta = aeps != 0 ? aeps : 0.01f;
500 double min_err = DBL_MAX, err = 0;
501 CvRNG rng = cvRNG(-1);
502
503 switch (dist)
504 {
505 case CV_DIST_L2:
506 return icvFitLine3D_wods( points, count, 0, line );
507
508 case CV_DIST_L1:
509 calc_weights = icvWeightL1;
510 break;
511
512 case CV_DIST_L12:
513 calc_weights = icvWeightL12;
514 break;
515
516 case CV_DIST_FAIR:
517 calc_weights_param = icvWeightFair;
518 break;
519
520 case CV_DIST_WELSCH:
521 calc_weights_param = icvWeightWelsch;
522 break;
523
524 case CV_DIST_HUBER:
525 calc_weights_param = icvWeightHuber;
526 break;
527
528 /*case CV_DIST_USER:
529 _PFP.p = param;
530 calc_weights = (void ( * )(float *, int, float *)) _PFP.fp;
531 break;*/
532
533 default:
534 return CV_BADFACTOR_ERR;
535 }
536
537 w = (float *) cvAlloc( count * sizeof( float ));
538 r = (float *) cvAlloc( count * sizeof( float ));
539
540 for( k = 0; k < 20; k++ )
541 {
542 int first = 1;
543 for( i = 0; i < count; i++ )
544 w[i] = 0.f;

Callers 1

cvFitLineFunction · 0.85

Calls 5

cvRNGFunction · 0.85
icvFitLine3D_wodsFunction · 0.85
cvAllocFunction · 0.85
cvRandIntFunction · 0.85
icvCalcDist3DFunction · 0.85

Tested by

no test coverage detected