示例#1
0
void cIncListInterv::AddInterv(const cIncIntervale & anInterv,bool CanOverlap)
{
   if (anInterv.Sz()==0 )
      return;
   for (tCSetIII anIt =  mMap.begin() ; anIt!= mMap.end() ; anIt++)
   {
       ELISE_ASSERT
       (
           anIt->Id() != anInterv.Id(),
           "Ambiguous Key in cIncListInterv::AddInterv"
       );
       if (CanOverlap)
          mMayOverlap = true;
       else
       {
           ELISE_ASSERT
           (
                ! (anInterv.Overlap(*anIt)),
               "Overlapping interval in cIncListInterv::AddInterv"
           );
       }
   }

   mMap.insert(anInterv);
   ElSetMin(mI0Min,anInterv.I0Alloc());
   ElSetMax(mI1Max,anInterv.I1Alloc());
   mSurf += anInterv.Sz();
}
示例#2
0
cLineSortie_Convol::cLineSortie_Convol
(
    cFiltreInterpol &  aFiltre,
    const cHomTr1D &   aHom,
    int                aPixOut0,
    int                aPixOut1,
    double             aDilateF
) :
   mPixOut0 (aPixOut0),
   mPixOut1 (aPixOut1)
{
   mVPSC.reserve(mPixOut1-mPixOut0);
   mLargMax =0;
   for (int aPixOut=mPixOut0 ; aPixOut<mPixOut1 ; aPixOut++)
   {
       mVPSC.push_back(cPixelSortie_Convol(aFiltre,aHom,aPixOut,aDilateF));
       cPixelSortie_Convol & mPCur = mVPSC[mVPSC.size()-1];
       ElSetMax(mLargMax,mPCur.PixIn1()-mPCur.PixIn0());
       if (aPixOut==mPixOut0)
       {
       }
       else
       {
           cPixelSortie_Convol & mPPrec = mVPSC[mVPSC.size()-2];
           ELISE_ASSERT
           (
                    mPCur.PixIn0()>=mPPrec.PixIn0()
               &&  (mPCur.PixIn1()>=mPPrec.PixIn1()),
               "Incoherence in cPixelSortie_Convol"
           );
       }
   }
   mPixIn0 = mVPSC[0].PixIn0();
   mPixIn1 = mVPSC.back().PixIn1();
}
示例#3
0
void ComputeIntervaleDelta
              (
                  INT & aDzMin,
                  INT & aDzMax,
                  INT aZ,
                  INT MaxDeltaZ,
                  INT aZ1Min,
                  INT aZ1Max,
                  INT aZ0Min,
                  INT aZ0Max
              )
{
      aDzMin =   aZ0Min-aZ;
      if (aZ != aZ1Min)
         ElSetMax(aDzMin,-MaxDeltaZ);

      aDzMax = aZ0Max-1-aZ;
      if (aZ != aZ1Max-1)
         ElSetMin(aDzMax,MaxDeltaZ);

       // Si les intervalles sont vides, on relie
       // les bornes des intervalles a tous les points
       if (aDzMin > aDzMax)
       {
          if (aDzMax <0)
             aDzMin = aDzMax;
          else
             aDzMax = aDzMin;
       }
}
示例#4
0
bool cOneImageOfLayer::LoadFileRed(const std::string & aNameRed)
{
    if ( !ELISE_fp::exist_file(aNameRed))  
       return false;
    mIm = Im2D_U_INT1::FromFileStd(aNameRed);
    mTIm = TIm2D<U_INT1,INT>(mIm);
    Pt2di aSzR = mIm.sz();
    mLabMin = 1000000;
    mLabMax = -1000000;
    Pt2di aP;
    for (aP.x=0 ; aP.x<aSzR.x; aP.x++)
    {
        for (aP.y=0 ; aP.y<aSzR.y; aP.y++)
        {
            int aLab = mTIm.get(aP);
            if (aLab != mTheNoLayer)
            {
               ElSetMin(mLabMin,aLab);
               ElSetMax(mLabMax,aLab);
           }
        }
    }
    std::cout  << "Labels, Min: " << mLabMin << " , Max :" << mLabMax << "\n";
    return true;
}
示例#5
0
void  HPoly
      (
           ActionSeg &             Act,
           ElFifo<Pt2dr> &   f,
           Pt2dr                   dir,
           REAL                    esp
      )
{
     REAL omax = -1e50;
     REAL omin =  1e50;

     SegComp s0 (Pt2dr(0,0),dir);

     for (INT k=0; k<f.nb() ; k++)
     {
          REAL ord = s0.ordonnee(f[k]);
          ElSetMax(omax,ord);
          ElSetMin(omin,ord);
     }
     
     for (REAL ord = round_up(omin/esp) *esp; ord<omax; ord += esp)
     {
          Pt2dr p0 = s0.from_rep_loc(Pt2dr(0.0,ord));
          ClipSeg(Act,f,Seg2d(p0,p0+s0.tangente()));
     }
      
}
示例#6
0
void ElImplemDequantifier::TraitCuv ( U_INT2 *  aDA,U_INT2 *  aDB)
{

    static std::vector<INT> Pts;
    Pts.reserve(3000);


    for (INT aP0=0; aP0<mNbPts ; aP0++)
    {
        if ((aDA[aP0] == eMaxDist) && (lDQ[aP0] != eValOut) )
	{
            Pts.push_back(aP0);
	    aDA[aP0] = eMaxDist-1;
	    INT aK = 0;
	    INT  NbV = 0;
	    INT  SigmaDV = 0;
            INT  aDmaxB = 0;
	    while (aK != INT (Pts.size()))
	    {
		INT aP =  Pts[aK];


                ElSetMax(aDmaxB,aDB[aP]);
		for (INT aKV =0 ; aKV < mNbVYT ; aKV++)
		{
                    INT aPV = aP + mVYT[aKV];
		    if (lDQ[aPV] == eValOut)
                    {
                    }
		    else if (aDA[aPV] == eMaxDist)
                    {
                         Pts.push_back(aPV);
	                 aDA[aPV] = eMaxDist-1;
                    }
                    else if (aDA[aPV] < eMaxDist-1)
	            {
			    NbV++;
			    SigmaDV += aDB[aPV];
		    }
		}
                aK++;
	    }
	    REAL DMoy = SigmaDV/REAL( NbV);
	    for (aK =0 ; aK<INT(Pts.size()) ; aK++)
            {
                INT aP = Pts[aK];
                INT aD = aDB[aP];

                REAL aPds = (2*aD*aDmaxB - ElSquare(aD))/REAL (aDmaxB*(aDmaxB+DMoy));


                aDB[aP] = round_ni(aPds*10000);
                aDA[aP] = 10000 - aDB[aP];
            }
            Pts.clear();
	}
    }

}
示例#7
0
bool  cImage::PIMsValideVis(const Pt3dr & aPTer)
{
   if (mPImsNuage==0) return true;

   Pt2dr aPIm = mPImsNuage->Terrain2Index(aPTer);
   Pt2di aIPIm = round_ni(aPIm);


   double aProfMax= -1e20;
   double aProfMin= 1e20;
   int aDil = round_up(mPNSeuilPlani);

   for (int aDx= -aDil ; aDx <= aDil ; aDx++)
   {
       for (int aDy= -aDil ; aDy <= aDil ; aDy++)
       {
            Pt2di aPVois(aIPIm.x+aDx,aIPIm.y+aDy);
            if ((mPImsNuage->IndexHasContenu(aPVois)) && (euclid(Pt2dr(aPVois)-aPIm)<mPNSeuilPlani))
            {
                double aProfNu = mPImsNuage->ProfEnPixel(aPVois);
                ElSetMax(aProfMax,aProfNu);
                ElSetMin(aProfMin,aProfNu);
            }
       }
   }


   Pt3dr aTerInNu = mPImsNuage->Euclid2ProfPixelAndIndex(aPTer);
   double aProfTer = aTerInNu.z;

    return (aProfTer >= (aProfMin-mPNSeuilAlti)) && (aProfTer<=(aProfMax+mPNSeuilAlti));

/*
std::cout << "Valll   BBBBBBB\n";
   if (! aEnv->IndexHasContenuForInterpol(aPIm))
   {
       // A Parametrer eventuellement
       return false;
   }

   Pt3dr aTerInNu = aEnv->Euclid2ProfPixelAndIndex(aPTer);
   double aProfTer = aTerInNu.z;
   double aProfNu = aEnv->ProfInterpEnPixel(aPIm);

   bool isDessus = (aProfTer >= aProfNu);

std::cout << "Valll   CCCCCCC " << aProfTer << " " << aProfNu << " \n";

   return aMin ?  isDessus : (! isDessus);
*/

  return false;

}
void SystLinSurResolu::AdjustSizeCapa()
{
   if ((mNbVarCur<=mNbVarCapa) && (mNbEqCur<=mNbEqCapa))
      return;

   if (mNbVarCur > mNbVarCapa)
      ElSetMax(mNbVarCapa,ElMax(2*mNbVarCapa,mNbVarCur));

   if (mNbEqCur>mNbEqCapa)
      ElSetMax( mNbEqCapa,ElMax(2*mNbEqCapa, mNbEqCur));

   mA = mA.AugmentSizeTo(Pt2di(mNbVarCapa,mNbEqCapa),0.0);
   mDataA   = mA.data();

   mB = mB.AugmentSizeTo(mNbEqCapa,0.0);
   mDataB   = mB.data();

   mPds = mPds.AugmentSizeTo(mNbEqCapa,1.0);
   mDataPds = mPds.data();
}
示例#9
0
double cElPolygone::DiamSimple() const
{
   tContour aC = ContSMax();
   double aD2Max = 0.0;
   for (int aK1 = 0 ; aK1 <int(aC.size()); aK1++)
       for (int aK2 = aK1+1 ; aK2 <int(aC.size()); aK2++)
       {
            ElSetMax(aD2Max,square_euclid(aC[aK1],aC[aK2]));
       }

  return sqrt(aD2Max);
}
示例#10
0
void cPushB_PhysMod::CoherARGlob(int aNbPts,double & aMoyCoh,double & aMaxCoh) const
{
    aMoyCoh = 0.0;
    aMaxCoh = 0.0;

    for (int anX=0 ; anX<=aNbPts ; anX++)
    {
        for (int anY=0 ; anY<=aNbPts ; anY++)
        {
            Pt2dr aPIm( (double(anX)*mSz.x)/aNbPts , (double(anY)*mSz.y)/aNbPts);
            double aCoh = CoherAR(aPIm);
            aMoyCoh += aCoh;
            ElSetMax(aMaxCoh,aCoh);
        }
    }
    aMoyCoh /= ElSquare(1+2*aNbPts);
}
示例#11
0
double  cObservLiaison_1Cple::AddObs
        (
	   const cPonderationPackMesure & aPPM,
	   const cPonderationPackMesure * aPPMSurf
	)
{
   if (mEqS)
   {
       ELISE_ASSERT(aPPMSurf!=0,"No Pond for contrainte-surface");
   }

   cPonderateur aPdrtIm(aPPM,mPack.size());


   cPonderateur aPdrtSurf = aPdrtIm;  // Pb d'init
   if (mEqS)
   {
       aPdrtSurf = cPonderateur(*aPPMSurf,mPack.size());
   }

   double aS1=0;
   double aSEr2=0;
   double aSomPdsSurf = 0;
   mEcMax = 0.0;

   for 
   (
       ElPackHomologue::tCstIter itL=mPack.begin();
       itL!=mPack.end();
       itL++
   )
   {
      if (true)
      {
	  double aNb = itL->Pds() * mMultPds;
	  std::vector<double> aVPds;
	  aVPds.push_back(1.0);
	  aVPds.push_back(1.0);


          //const std::vector<Pt2dr> & aPTers = mPLiaisTer->ResiduPointLiaison(*itL,&aPInter);
	  const cResiduP3Inc & aRes = mPLiaisTer->UsePointLiaison(cArg_UPL(0),-1,-1,0.0,*itL,aVPds,false);
          double aResidu = (square_euclid(aRes.mEcIm[0])+square_euclid(aRes.mEcIm[1]));

	  ElSetMax(mEcMax,sqrt(aResidu));

	  double aPdsIm = aPdrtIm.PdsOfError(sqrt(aResidu));
          aVPds[0]= (aPdsIm*aNb);
          aVPds[1]= (aPdsIm*aNb);

	  double aPdsSurf = 0;
	  if (mEqS)
	  {
             aPdsSurf = aPdrtSurf.PdsOfError(ElAbs(aRes.mEcSurf)) *aNb;
	  }
	  aSomPdsSurf += aPdsSurf;
          mPLiaisTer->UsePointLiaison(cArg_UPL(0),-1,-1,aPdsSurf,*itL,aVPds,true);
	  aSEr2 += aResidu * aNb;
          aS1 += aNb;


          if (int(aPPM.Show().Val()) >= int(eNSM_Indiv))
            std::cout << "RLiais = " << sqrt(aResidu) << " pour P1 " << itL->P1() << "\n";

	    mPose1->AddPMoy(itL->P1(),aRes.mPTer,aRes.mBSurH);
	    mPose2->AddPMoy(itL->P2(),aRes.mPTer,aRes.mBSurH);
      }

   }
   aSEr2 /= aS1;

   if (int(aPPM.Show().Val()) >= int(eNSM_Paquet))
   {
      if (mEqS)
         std::cout << "PDS Surf = " << aSomPdsSurf << "\n";
      std::cout << "| | | RESIDU LIAISON (pixel) =  Ter-Im :" << sqrt(aSEr2)
                << " pour ["  << mIm1 << "/" << mIm2 << "]"
		<< " Max = " << mEcMax
                << "\n";
   }

// getchar();
   return aSEr2 ;
}
示例#12
0
	void 	Scale_Im_Compr<TObj,TLut,TInd>::DoItReduce()
{
    ElTimer aTimer;

	for (INT wy=this->_pW0.y; wy<this->_pW1.y; wy++)
	{
		INT yU0 = round_down(this->y_to_user(wy-0.5));
		INT yU1 = round_up(this->y_to_user(wy+0.5));


		ElSetMax(yU0,0);
		ElSetMin(yU1,this->_SzU.y-1);

		for (INT ux= this->_pW0.x -(Scale_Im_Compr<TObj,TLut,TInd>::RAB) ;
			ux<this->_pW1.x +(Scale_Im_Compr<TObj,TLut,TInd>::RAB); ux++)
			this->_l0[ux] = 0;



		INT pdsTot = 0;

		if (yU0<yU1)
		{

			for (INT uy= yU0; uy<=yU1 ; uy++)
			{
				REAL yW0 = std::max(this->y_to_window(uy-0.5),wy-0.5);
				REAL yW1 = std::min(this->y_to_window(uy+0.5),wy+0.5);
				
				INT pds = round_ni((yW1-yW0) * this->_CoeffPds);
				if (pds > 0)
				{
					pdsTot += 0;
					_CurPds = pds;
					DeCompr
					(
					        _dim->lpckb(uy),
						*this,
						this->_xU0,
						this->_xU1,
						_dim->per()
					);
					pdsTot += pds;
				}
			}
			if (pdsTot)
			{
				
				{
				for (INT ux= this->_pW0.x ;  ux<this->_pW1.x +(Scale_Im_Compr<TObj,TLut,TInd>::RAB) ; ux++)
					this->_l0[ux] += this->_l0[ux-1];
				}
				INT pxy = pdsTot * this->_CoeffPds;

				{
				for (INT ux= this->_pW0.x ;  ux<this->_pW1.x ; ux++)
					this->_l0[ux] /= pxy;
                }

                mTimeUnCompr += aTimer.uval();
				RasterUseLine
				(
					Pt2di(this->_pW0.x,wy),
					Pt2di(this->_pW1.x,wy+1),
					this->_line
				);
                aTimer.reinit();
			}
		}
	}
} 
示例#13
0
文件: b_0_48.cpp 项目: jakexie/micmac
void Optim_L1FormLin::CombinConjMinLoc
     (
        ElFilo<REAL>&  dic,
        ElFilo<INT> &  Subset,
        ElFilo<INT> &  FlagPos
     )
{
    CPT ++;
    INT NbF = (1<<_NbForm);
    for (INT k=dic.nb() ;k<NbF ; k++)
        dic.pushlast(1e20);

    FlagPos.clear();

    CombinConjMinLoc(dic,Subset,FlagPos,0,0,0);

    INT NbMin0 =0;
    INT NbMin1 =0;

    REAL M0 = 1e80,M1 = -1e80;

	{
    for (INT k=0 ; k< FlagPos.nb(); k++)
    {


        REAL VN = TestNeighConjMinLoc(FlagPos[k],dic);
        REAL V0 = dic[FlagPos[k]];

        if (V0 < VN)
           NbMin0 ++;
        if (V0 <=  VN)
        {
           NbMin1 ++;
           ElSetMin(M0,V0);
           ElSetMax(M1,V0);
        }

/*
        {
          show_flag(FlagPos[k]);
          cout << " : " << dic[FlagPos[k]];
          if (V0 <= VN) 
             cout << " ** ";
          cout << "\n";
        }
*/
    }
	}

/*
    if ((NbMin0!=1) || (NbMin1!=1))
        cout << NbMin0 << " " << NbMin1 << "\n";
*/

    BENCH_ASSERT(NbMin0 <= 1);
    BENCH_ASSERT(NbMin1 >= 1);

   cout << "MINS = " << M0 << " " << M1 << "\n";
   BENCH_ASSERT(std::abs(M0-M1)<epsilon);


   {
    for (INT k=0 ; k< FlagPos.nb(); k++)
        dic[FlagPos[k]] = 1e20;

   }
}
示例#14
0
cElNuageLaser::cElNuageLaser
(
     const std::string & aNameFile,
     const char *  aNameOri,
     const char *  aNameGeomCible ,
     const char *  aNameGeomInit

)  :
   mVPts (),
   mQt   (0)
{
   std::string aNameBin = StdPrefix(aNameFile) + ".tif";
   if (! ELISE_fp::exist_file(aNameBin))
   {
       INT aNb = 3;
       FILE * aFP = ElFopen(aNameFile.c_str(),"r");
       ELISE_ASSERT(aFP!=0,"Cannot Open File for Laser Data");

       char Buf[10000];
       INT aCpt =0;
       while (aNb>=3)
       {
           aNb=0;
           char * got = fgets(Buf,10000,aFP);
           Pt3dr aP;
           if (got)
           {
              aNb = sscanf(Buf,"%lf %lf %lf",&aP.x,&aP.y,&aP.z);
           }
	   if (aNb>=3)
              mVPts.push_back(aP);
	   aCpt++;
       }

       INT aNbPts = (INT) mVPts.size();
       Im2D_REAL8 aImPts(aNbPts,3);
       REAL ** aData = aImPts.data();
       for (INT aK=0 ; aK<aNbPts ; aK++)
       {
	   Pt3dr aP = mVPts[aK];
           aData[0][aK] = aP.x;
           aData[1][aK] = aP.y;
           aData[2][aK] = aP.z;
       }

       Tiff_Im aFile
	       (
                  aNameBin.c_str(),
		  Pt2di(aNbPts,3),
		  GenIm::real8,
		  Tiff_Im::No_Compr,
		  Tiff_Im::BlackIsZero,
		     Tiff_Im::Empty_ARG
		  +  Arg_Tiff(Tiff_Im::ANoStrip())
               );
       ELISE_COPY(aImPts.all_pts(),aImPts.in(),aFile.out());
   }
   else
   {
       Tiff_Im aFile(aNameBin.c_str());
       Pt2di aSz = aFile.sz();
       Im2D_REAL8 aImPts(aSz.x,aSz.y);
       ELISE_COPY(aImPts.all_pts(),aFile.in(),aImPts.out());

       REAL ** aD = aImPts.data();
       mVPts.reserve(aSz.x);
       for (INT aK=0 ; aK<aSz.x ; aK++)
       {
           Pt3dr aP(aD[0][aK],aD[1][aK],aD[2][aK]);
           mVPts.push_back(aP);
       }
   }


   Ori3D_Std * aOri = 0;
   eModeConvGeom aMode = eConvId;

   if (aNameOri)
   {
       if (!strcmp(aNameGeomInit,"GeomCarto"))
       {
           if (!strcmp(aNameGeomCible,"GeomCarto"))
           {
               aMode = eConvId;
           }
           else if (!strcmp(aNameGeomCible,"GeomTerrain"))
           {
               aMode = eConvCarto2Terr;
           }
           else if (!strcmp(aNameGeomCible,"GeomTerIm1"))
           {
               aMode = eConvCarto2TerIm;
           }
           else
           {
              ELISE_ASSERT(false,"Bad GeomCible in cElNuageLaser::cElNuageLaser");
           }
       }
       else
       {
           ELISE_ASSERT(false,"Bad GeomInit in cElNuageLaser::cElNuageLaser");
       }
       if (aMode != eConvId)
          aOri = new Ori3D_Std (aNameOri) ;
   }

   for (INT aK=0 ; aK<INT( mVPts.size()); aK++)
   {
       Pt3dr aP = mVPts[aK];
       if (aOri)
       {
          if (aMode == eConvCarto2Terr)
             aP = aOri->carte_to_terr(aP);
          else if (aMode == eConvCarto2TerIm)
          {
             aP = aOri->carte_to_terr(aP);
             Pt2dr aP2 = aOri->to_photo(aP);
             aP.x = aP2.x;
             aP.y = aP2.y;
          }
          mVPts[aK] = aP;
       }

       REAL  aZ   =  aP.z;
       Pt2dr aP2 (aP.x,aP.y);
       if (aK==0)
       {
           mZMax = mZMin = aZ;
           mPInf =mPSup = aP2;
       }
       ElSetMin(mZMin,aZ);
       ElSetMax(mZMax,aZ);
       mPInf.SetInf(aP2);
       mPSup.SetSup(aP2);
   }
   delete aOri;
}
		void UpdateSize(unsigned int sz)
		{
			ElSetMax(sz_buf,sz);
		}
示例#16
0
GMCube::GMCube(std::string aName)  :
    mP0     (0,0),
    mSz     (20000,20000),
    aFp     ( aName.c_str(),ELISE_fp::READ),
    mX0     ( aFp.read_REAL8()),
    mY0     ( aFp.read_REAL8()),
    mZ0     ( aFp.read_REAL8()),
    mStepXY ( aFp.read_REAL8()),
    mStepZ  ( aFp.read_REAL8()),
    mTx     ( aFp.read_INT4()),
    mTy     ( aFp.read_INT4()),
    mTz     ( aFp.read_INT4()),
    mIZmin  ( mTx, mTy),
    mIZmax  ( mTx, mTy),
    mZoom   (1.0),
    mW      (Video_Win::WStd(Pt2di(mTx,mTy),mZoom)),
    mW2     (Video_Win::WStd(Pt2di(mTx,mTy),mZoom)),
    mW3     (Video_Win::WStd(Pt2di(200,100),mZoom)),
    mW4     (Video_Win::WStd(Pt2di(mTx,mTy),mZoom)),
    mDisp   (mW2.disp())
{

   mSz = Inf(mSz,Pt2di(mTx,mTy));


   INT aNbZ =0;
   long aDeb = aFp.tell();
   INT aMaxZ =0;

   INT aVMax = -1000000;
   INT aVMin = 100000;
   for(INT y=0;y<mTy;++y)
   {

      for(INT x=0;x<mTx;++x)
      {
          INT2 zM  = aFp.read_INT2();
          INT2 aN  = aFp.read_INT2();

          mIZmin.data()[y][x] = zM;
          mIZmax.data()[y][x] = zM+aN;
          ElSetMax(aMaxZ ,(INT) aN);

          for (INT z=0 ; z<aN ; z++)
          {
              INT2 aVal =  aFp.read_INT2();
              ElSetMin(aVMin,aVal);
              ElSetMax(aVMax,aVal);
          }
          aNbZ += aN;
      }
   }

   cout << "NbZ = " << aNbZ <<  "  " << mStepZ << "\n";

   pSCA =     cInterfaceCoxAlgo::StdNewOne
              (
                  mSz,
                  trans(mIZmin.in(),mP0),
                  trans(mIZmax.in(),mP0),
                  2,
                  true
              );
cout << "AAAAAAAAAAAAa\n";

   
   aFp.seek_begin(aDeb);
   Im2D_INT2 zCor(mTx,mTy);
   Im2D_U_INT1 CorMax(mTx,mTy);


   for(INT y=0;y<mTy;++y)
   {
      for(INT x=0;x<mTx;++x)
      {
          INT2 z1  = aFp.read_INT2();
          INT2 z2  = z1+aFp.read_INT2();
 
          INT cMax = -100000;
          INT zMax = z1;

          bool OkP2 = (x>=mP0.x) && (x<mP0.x+mSz.x) && (y>=mP0.y) && (y<mP0.y+mSz.y);
          for (INT z=z1 ; z<z2 ; z++)
          {
              INT2 aVal =  aFp.read_INT2();
              if (aVal > cMax)
              {
                   cMax = aVal;
                   zMax = z;
              }
              aVal = round_ni((aVMax-aVal)/(aVMax/100.0));
              if (OkP2)
                  pSCA->SetCost(Pt3di(x-mP0.x,y-mP0.y,z),aVal);
          }
          zCor.data()[y][x] = zMax;
          CorMax.data()[y][x] = (INT)(255 * (1.0-cMax/900.0));
      }
   }

   cout << "VALS = [" << aVMin << " , " << aVMax << "]\n";

   ELISE_COPY(zCor.all_pts(),CorMax.in(),mW.ogray());
   ELISE_COPY(zCor.all_pts(),zCor.in(),mW2.ogray());

}
示例#17
0
void cPushB_PhysMod::PostInitLinesPB()
{
    mMoyRay = 0;
    mMoyAlt = 0;
    for (int aK=0 ; aK<= mSzGeoL.y ; aK++)
    {
         double anY = (mSwapXY ? mSz.x : mSz.y)  * (aK/double(mSzGeoL.y)); 
         cPushB_GeomLine * aLPB = new cPushB_GeomLine(this,mSzGeoL.x,anY);
         mLinesPB.push_back(aLPB);
         mMoyRay +=  euclid(aLPB->Center());
         mMoyAlt +=  euclid(aLPB->Center()) - TheRayTerre;
         
    }

    mMoyRay /= mLinesPB.size();
    mMoyAlt /= mLinesPB.size();

    mPeriod = sqrt((4*ElSquare(PI) * pow(mMoyRay,3)) / (TheCsteGravi*TheMasseTerre));

    double aDist = euclid(mLinesPB.front()->CUnRot()-mLinesPB.back()->CUnRot());
    double aTeta = 2 * asin((aDist/2.0) / mMoyRay);
    mDureeAcq = mPeriod * (aTeta/ (2*PI));

    // Tentative de correction de la rotation de la terre pour retrouber une trajectoire plane
    for (int aK=0 ; aK< int(mLinesPB.size()) ; aK++)
    {
        Pt3dr aC = mLinesPB[aK]->Center();
        aC = cSysCoord::WGS84Degre()->FromGeoC(aC);
        aC.x +=  360.0 * (double(aK)/mLinesPB.size() ) * (mDureeAcq/(24*3600.0));
        aC =  cSysCoord::WGS84Degre()->ToGeoC(aC);
        mLinesPB[aK]->CUnRot() = aC;
    }

    //   Stat sur les indicateurs
    mMoyRes = 0;
    mMaxRes = 0;
    mMoyPlan = 0;
    mMaxPlan = 0;
    for (int aK=0 ; aK<int(mLinesPB.size())  ; aK++)
    {
         cPushB_GeomLine * aLPB = mLinesPB[aK];

         mMoyRes += aLPB->MoyResiduCenter();
         ElSetMax(mMaxRes,aLPB->MaxResiduCenter());
         mMoyPlan += aLPB->MoyDistPlan();
         ElSetMax(mMaxPlan,aLPB->MaxDistPlan());
    }


    // Calcul de la calibration 
    mCalib = mLinesPB[0]->Calib();
    int aNbC = (int)mCalib.size();
    for (int aKL=1 ; aKL< int(mLinesPB.size()) ; aKL++)
    {
        const std::vector<double>  aCalK =  mLinesPB[aKL]->Calib();
        ELISE_ASSERT(aNbC==int(aCalK.size()),"Incohe size of Calib in cPushB_PhysMod::PostInitLinesPB");
        for (int aKC=0 ;  aKC<aNbC ; aKC++)
        {
             mCalib[aKC] += aCalK[aKC];
        }
    }
    // double a
    mMoyCalib = 0.0;
    mMaxCalib = 0.0;
    for (int aKC=0 ;  aKC<aNbC ; aKC++)
    {
        mCalib[aKC] /= mLinesPB.size();
        for (int aKL=0 ; aKL< int(mLinesPB.size()) ; aKL++)
        {
            double anEr = ElAbs(mCalib[aKC]-mLinesPB[aKL]->Calib()[aKC]);
            ElSetMax(mMaxCalib,anEr);
            mMoyCalib += anEr;
        }
    }
    mMoyCalib /= aNbC * mLinesPB.size();
}