コード例 #1
0
void cASAMG::TestDifProf(const cASAMG & aNE) const
{
    Im2D_REAL4 aImDif(mSz.x,mSz.y,1000);
    TIm2D<REAL4,REAL8> aTDif(aImDif);
    Pt2di anIndex;

    for (anIndex.x=0 ; anIndex.x <mSz.x ; anIndex.x++)
    {
        for (anIndex.y=0 ; anIndex.y <mSz.y ; anIndex.y++)
        {
             if (mTMasqN.get(anIndex))
             {
                 Pt3dr aPE = mStdN->PtOfIndex(anIndex);
                 aTDif.oset(anIndex,aNE.SignedDifProf(aPE));
             }
        }
    }
    Video_Win * aW = TheWinIm();
    if (aW)
    {
       ELISE_COPY
       (
           aImDif.all_pts(),
           Min(255,Abs(aImDif.in()*300)),
           aW->ogray()
       );
       aW->clik_in();
    }

}
コード例 #2
0
void cASAMG::TestImCoher() 
{
    ElTimer aChrono;
    const   std::vector<cASAMG *> & aVN = mCloseNeigh;

    int aNbIm = aVN.size();
    Im2D_REAL4 aImDif(mSz.x,mSz.y,1000);
    TIm2D<REAL4,REAL8> aTDif(aImDif);
    Pt2di aP;

    for (aP.x=0 ; aP.x<mSz.x ; aP.x++)
    {
        for (aP.y=0 ; aP.y<mSz.y ; aP.y++)
        {
             if (mTMasqN.get(aP))
             {
                 Pt3dr aPE = mStdN->PtOfIndex(aP);
                 double aSom=0;
                 for (int aK=0 ; aK<aNbIm ; aK++)
                 {
                     aSom += aVN[aK]->QualityProjOnMe(aPE);
                 }
                 aTDif.oset(aP,aSom);
             }
        }
    }

    for (int aNbRec = 3 ; aNbRec>=0 ; aNbRec --)
    {
        double aSeuil = aNbRec-0.25;
        Fonc_Num aFInside = aImDif.in(-1) > aSeuil;
        if (aNbRec>0)
        {
            eQualCloud aQual = eQC_Coh1;
            if (aNbRec==2) aQual = eQC_Coh2;
            if (aNbRec==3) aQual = eQC_Coh3;
            // Pour ceux qui ont ete valide (aNbRec> 0.75) et non bord ou autre chose ont leur met la bonne valeur
            ELISE_COPY
            (
                 select(mImQuality.all_pts(),aFInside && (mImQuality.in()==eQC_NonAff)),
                 aQual,
                 mImQuality.out()
            );

            ELISE_COPY
            (
                 select
                 (
                      mImQuality.all_pts(),
                         aFInside 
                      && (mImQuality.in()==eQC_GradFaibleC1) 
                      && (erod_32(mMasqN.in_proj(),2*mPrm.DilateBord().Val()))
                 ),
                 eQC_GradFaibleC2,
                 mImQuality.out()
            );
        }
        else
        {
            aFInside =  aImDif.in(-1) <= (aSeuil+1);
            Im2D_Bits<1>   aImLQ(mSz.x,mSz.y);
            ELISE_COPY(aImLQ.all_pts(),aFInside,aImLQ.out());

            ELISE_COPY
            (
                 select(mImQuality.all_pts(), aImLQ.in() && (mImQuality.in()==eQC_NonAff)),
                 eQC_ZeroCohImMul,
                 mImQuality.out()
            );
            ELISE_COPY
            (
                 select
                 (
                     mImQuality.all_pts(),
                     aImLQ.in()&&( mImQuality.in()>=eQC_GradFort) && ( mImQuality.in()<=eQC_Bord)
                 ),
                 eQC_ZeroCohBrd,
                 mImQuality.out()
            );
/*
*/
        }
    }
    ELISE_COPY(mImQuality.border(1),eQC_Out,mImQuality.out());
    InitGlobHisto();

    for (int aK=0 ; aK<mHisto.tx() ; aK++)
    {
        if (mDH[aK])
        {
           mMaxNivH = aK;
        }
    }

   
    Video_Win * aW =  mAppli->Param().VisuImageCoh().Val() ? TheWinIm() : 0 ;
    if (aW)
    {
        aW->set_title(mIma->mNameIm.c_str());
        std::cout << "For " << mIma->mNameIm << " time " << aChrono.uval() << " NbIm " << aNbIm << "\n";
        Fonc_Num fGray = Min(255,aImDif.in() * (255.0/aNbIm));

        for (int aK=0 ; aK<mHisto.tx() ; aK++)
            std::cout << "H[" << aK << "]= " << mHisto.data()[aK] << "\n";
        InspectQual(true);
        
    }
}
コード例 #3
0
ファイル: Match1.cpp プロジェクト: jakexie/micmac
int  TD_Match2_main(int argc,char ** argv)
{

    std::string aNameI1,aNameI2;
    int aDeltaPax=100;
    int aSzW = 5;
    
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aNameI1,"Name Im1")
					<< EAMC(aNameI2,"Name Im2"),
        LArgMain()  << EAM(aDeltaPax,"DPax",true,"Delta paralax")
                    << EAM(aSzW,"SzW",true,"Size of Window, Def=5")
    );
    
       // image 1
    cTD_Im aI1 = cTD_Im::FromString(aNameI1);
    // image 2
    cTD_Im aI2 = cTD_Im::FromString(aNameI2);
    
    //dimension de nos images, sera utile pour nos boucles
    Pt2di aSz = aI1.Sz();
    
    cTD_Im aIBestScore(aSz.x,aSz.y);
    cTD_Im aIBestPax(aSz.x,aSz.y);
    Pt2di aP;    

    for (aP.x=0; aP.x < aSz.x ; aP.x++)
    {
		for (aP.y=0 ; aP.y < aSz.y ; aP.y++)
		{
		   aIBestScore.SetVal(aP.x,aP.y,Beaucoup);
		   aIBestPax.SetVal(aP.x,aP.y,sin((float)aP.x)*30*sin((float)aP.y));
		}
	}
    
    Pt2di aPPax;
    for ( aPPax.x = -aDeltaPax ; aPPax.x<=aDeltaPax ; aPPax.x++)
	{
		std::cout << "Pax= " << aPPax.x << "\n";
		
	// Calculer images des valeurs absolue des difference trans
		cTD_Im aImDif(aSz.x,aSz.y);

		for (aP.x=0; aP.x < aSz.x ; aP.x++)
		{
			for (aP.y=0 ; aP.y < aSz.y ; aP.y++)
			{
				Pt2di aPTr = aP + aPPax;
				float aDif = 256;
				if (aI2.Ok(aPTr.x,aPTr.y))
				{
					 aDif = aI1.GetVal(aP) - aI2.GetVal(aPTr);
				}
				aImDif.SetVal(aP.x,aP.y,std::fabs(aDif));
			}
		}
		

		 //  Calculer l'image moyenne
		 
		 cTD_Im aImDifMoy = aImDif.ImageMoy(aSzW,1);

		 // Mettre a jour aIBestScore et aIBestPax
		 
		 
		for (aP.x=0; aP.x < aSz.x ; aP.x++)
		{
			for (aP.y=0 ; aP.y < aSz.y ; aP.y++)
			{
				float aDif =aImDifMoy.GetVal(aP);
				if (aDif<aIBestScore.GetVal(aP))
				{
					 aIBestScore.SetVal(aP.x,aP.y,aDif);
					 aIBestPax.SetVal(aP.x,aP.y,aPPax.x);
				}
			}
		}
	}
	aIBestPax.Save("CartePax2.tif");
	
    return EXIT_SUCCESS;
}