int solveLinearSystemGJ(double * result , double * coefficients , unsigned int variables , unsigned int totalLines ) { fprintf(stderr,"solveLinearSystemGJ : Variables %u argument is not taken into account (?)",variables); char name[128]={0}; //Make the system upper diagonal unsigned int i=0; for (i=0; i<totalLines; i++) { if (! makeSureNonZero(coefficients,i,totalLines) ) { fprintf(stderr,"Error making sure that we have a non zero element first ( %u ) \n", i ); break; } if (! createBaseOne(coefficients,i) ) { fprintf(stderr,"Error creating base one ( %u ) \n", i ); break; } if (! subtractBase(coefficients,i,totalLines) ) { fprintf(stderr,"Error subtracting base ( %u ) \n" , i ); break; } sprintf(name,"Echeloned Step %u",i); printSystemPlain(coefficients,name,totalLines); } fprintf(stderr,"\n\n"); printSystemPlain(coefficients,"Echeloned",totalLines); //Populate the results matrix return gatherResult(result,coefficients,totalLines); }
void AdaptiveManifoldFilterN::filter(InputArray src, OutputArray dst, InputArray joint) { CV_Assert(sigma_s_ >= 1 && (sigma_r_ > 0 && sigma_r_ <= 1)); num_pca_iterations_ = std::max(1, num_pca_iterations_); initBuffers(src, joint); curTreeHeight = tree_height_ <= 0 ? computeManifoldTreeHeight(sigma_s_, sigma_r_) : tree_height_; sigma_r_over_sqrt_2 = (float) (sigma_r_ / sqrt(2.0)); const double seedCoef = jointCn[0].at<float>(srcSize.height/2, srcSize.width/2); const uint64 baseCoef = numeric_limits<uint64>::max() / 0xFFFF; rnd.state = static_cast<int64>(baseCoef*seedCoef); Mat1b cluster0(srcSize, 0xFF); vector<Mat> eta0(jointCnNum); for (int i = 0; i < jointCnNum; i++) h_filter(jointCn[i], eta0[i], (float)sigma_s_); buildManifoldsAndPerformFiltering(eta0, cluster0, 1); gatherResult(src, dst); }