コード例 #1
0
ファイル: b_0_48.cpp プロジェクト: jakexie/micmac
void Craig_etal_L1
     (
             Im2D_REAL8  A,
             Im1D_REAL8  B,
             REAL        TOLER,
             Im1D_REAL8  SOL,
             Im1D_REAL8  RESIDU
     )
{
    INT n = SOL.tx();
    INT m = B.tx();

    BENCH_ASSERT
    (
           (A.tx() == n+2)
        && (A.ty() == m+2)
        && (B.tx() == m)
        && (SOL.tx() == n)
        && (RESIDU.tx() == m)
    );
    Craig_Barrodale_Roberts_l1
    (
        m,n,
        A.data_lin(),
        B.data(),
        TOLER,
        SOL.data(),
        RESIDU.data()
    );
}
コード例 #2
0
void cDbleGrid::SauvDataGrid
     (
         const std::string &  aNameDir,
         Im2D_REAL8 anIm,
         const std::string & aName
     )
{
     std::string aFullName = aNameDir + aName + ".dat";
     ELISE_fp  aFp(aFullName.c_str(),ELISE_fp::WRITE);
     aFp.write(anIm.data_lin(),sizeof(double),anIm.tx()*anIm.ty());
     aFp.close();
}
コード例 #3
0
RImGrid::RImGrid
(
     Pt2dr      anOrigine,
     Pt2dr      aStep,
     Im2D_REAL8 anIm
) :
   mP0      (anOrigine),
   mP1      (mP0+Pt2dr(anIm.sz() -Pt2di(1,1)).mcbyc(aStep)),
   mStepGr  (aStep),
   mSzGrid  (anIm.sz()),
   mDef     (-1e20),
   mGrid    (anIm),
   mTim     (new TIm2D<REAL,REAL>(mGrid)),
   mName    ("No Name"),
   mStepAdapted (true)
{
}
コード例 #4
0
ファイル: b_0_53.cpp プロジェクト: jakexie/micmac
     void VerifCorrelCNC
          (
               Pt2di aDec,
               bool Pondered,
               Im2D_REAL8 aCPad,
               REAL anEps,
               Im2D_REAL8  aCNC,
               REAL aRatioSurf
          )
     {
	      REAL aS_CorFFT = ImCorrFromNrFFT(aCPad,aDec);

	      REAL aS,aS1,aS2,aS11,aS12,aS22;

              Symb_FNum aP (    Pondered                                ?
                                trans(mPds1.in(0),aDec)*mPds2.in(0)     :
                                trans(mIm1.inside(),aDec)
                           );
              Symb_FNum aF1 (trans(mIm1.in(0),aDec));
              Symb_FNum aF2 (mIm2.in(0));

              ELISE_COPY 
              ( 
                 mIm1.all_pts(), 
                 Virgule
                 (
                   1,aF1,aF2,
                   aF1*aF1,aF1*aF2,aF2*aF2
                 )*aP,
                 Virgule
                 (
                       Virgule(sigma(aS)  ,sigma(aS1) ,sigma(aS2)),
                       Virgule(sigma(aS11),sigma(aS12),sigma(aS22))
                 )
              );
              if (! Pondered)
	          BENCH_ASSERT(std::abs(aS12-aS_CorFFT )<epsilon);

              aS = std::max(aS,anEps);
              aS1 /= aS;
              aS2 /= aS;
              aS11 = aS11/aS - aS1 * aS1 ;
              aS12 = aS12/aS - aS1 * aS2 ;
              aS22 = aS22/aS - aS2 * aS2 ;

              REAL aCor = aS12 / sqrt(std::max(anEps,aS11*aS22));	
              if (aS<aRatioSurf)
              {
                   aCor = -1 + (aCor+1) * (aS/aRatioSurf);
              }


	      REAL aNCCorFFT = ImCorrFromNrFFT(aCNC,aDec);


              BENCH_ASSERT(std::abs(aCor-aNCCorFFT)<epsilon);
      }
コード例 #5
0
ファイル: b_0_53.cpp プロジェクト: jakexie/micmac
     cBenchCorrel (Pt2di aSz) :
         mIm1(aSz.x,aSz.y),
         mDup1(aSz.x,aSz.y),
         mPds1(aSz.x,aSz.y),
         mIm2(aSz.x,aSz.y),
         mDup2(aSz.x,aSz.y),
         mPds2(aSz.x,aSz.y)
     {


           ELISE_COPY(mIm1.all_pts(),frandr(),mIm1.out()|mDup1.out());
           ELISE_COPY(mIm2.all_pts(),frandr(),mIm2.out()|mDup2.out());


           ELISE_COPY(mIm1.all_pts(),frandr(),mPds1.out());
           ELISE_COPY(mIm1.all_pts(),frandr(),mPds2.out());



           ElFFTCorrelCirc(mDup1,mDup2);
           Im2D_REAL8 aCPad = ElFFTCorrelPadded(mIm1, mIm2);


           REAL anEps = (1+10*NRrandom3()) * 1e-2;

           REAL aRatioSurf = aSz.x * aSz.y * (1+NRrandom3()) / 6.0;

           Im2D_REAL8 aCNC = ElFFTCorrelNCPadded(mIm1, mIm2,anEps,aRatioSurf);
           Im2D_REAL8 aPdsCNC = ElFFTPonderedCorrelNCPadded
                          (
                                mIm1.in(),
                                mIm2.in(),
                                aSz,
                                mPds1.in(),
                                mPds2.in(),
                                anEps,
                                aRatioSurf
                          );

           for (INT x =-1 ; x<= aSz.x ; x++)
           {
               for (INT y =-1 ; y<= aSz.y ; y++)
               {
                    REAL aSElise;
                    ELISE_COPY
                    (
	                mIm1.all_pts(),
		          mIm1.in()[Virgule(mod(FX+x,aSz.x),mod(FY+y,aSz.y))] 
		        * mIm2.in(),
		        sigma(aSElise)
                    );

	            REAL aSFFT = mDup1.data()[mod(y,aSz.y)][mod(x,aSz.x)];

	            BENCH_ASSERT(std::abs(aSElise-aSFFT)<epsilon);

                    Pt2di aDec(x,y);
                    VerifCorrelCNC(aDec,false,aCPad, anEps,aCNC,aRatioSurf);
                    VerifCorrelCNC(aDec,true,aCPad, anEps,aPdsCNC,aRatioSurf);

               }
           }
     }