Exemplo n.º 1
0
void cAppliApero::SimuleOneLiaison
     (
         const cGenerateLiaisons & aGL,
	 const std::list<Pt3dr>  & aLP3,
         cPoseCam & aCam1,
         cPoseCam & aCam2
     )
{
   const CamStenope * aCS1 = aCam1.CurCam();
   const CamStenope * aCS2 = aCam2.CurCam();

   ElPackHomologue aPack;

   for(std::list<Pt3dr>::const_iterator itP3=aLP3.begin();itP3!=aLP3.end();itP3++)
   {
      Pt2dr aPIm1 = aCS1->R3toF2(*itP3)+Pt2dr(NRrandC(),NRrandC())*aGL.BruitIm1();
      Pt2dr aPIm2 = aCS2->R3toF2(*itP3)+Pt2dr(NRrandC(),NRrandC())*aGL.BruitIm2();

      aPack.Cple_Add(ElCplePtsHomologues(aPIm1,aPIm2));
   }

   std::string aName = mDC+mICNM->Assoc1To2(aGL.KeyAssoc(),aCam1.Name(),aCam2.Name(),true);
   cElXMLFileIn aFileXML(aName);
   aFileXML.PutPackHom(aPack);
}
ElPackHomologue PackFromCplAPF(const cMesureAppuiFlottant1Im & aMes, const cMesureAppuiFlottant1Im & aRef)
{
   ElPackHomologue aRes;

   for 
   (
         std::list<cOneMesureAF1I>::const_iterator iT=aMes.OneMesureAF1I().begin();
         iT!=aMes.OneMesureAF1I().end();
         iT++
   )
   {
       const cOneMesureAF1I * aPt = PtsOfName(aRef,iT->NamePt());
       if (aPt!=0)
       {
           aRes.Cple_Add(ElCplePtsHomologues(iT->PtIm(),aPt->PtIm()));
       }
       else
       {
           std::cout << "For name " << iT->NamePt() << "\n";
           ELISE_ASSERT(false,"Cannot get name in merging two cMesureAppuiFlottant1Im");
       }
   }

   return aRes;
}
Exemplo n.º 3
0
void cOneImageOfLayer::SplitLayer
     (
          cOneImageOfLayer& aL2,
          const std::string & aNameH,
          const cSplitLayer & aSL
     )
{
   ElPackHomologue aPck = ElPackHomologue::FromFile(mAppli.DC()+aNameH);
   int aLMin = ElMax(mLabMin,aL2.mLabMin);
   int aLMax = ElMin(mLabMax,aL2.mLabMax);

   for (int aLab = aLMin ; aLab<=aLMax ; aLab++)
   {
       ElPackHomologue aPackR;
       for
       (
            ElPackHomologue::iterator itP=aPck.begin();
            itP!=aPck.end();
            itP++
       )
       {
            if (
                      (LayerOfPt(itP->P1()) == aLab)
                   && (aL2.LayerOfPt(itP->P2()) == aLab)
               )
            {
                aPackR.Cple_Add(ElCplePtsHomologues(itP->P1(),itP->P2()));
            }
       }
 
       std::string aNameRed =  mAppli.DC()+ mAppli.ICNM()->Assoc1To2
                               (
                                    aSL.KeyCalHomSplit(),
                                    aNameH,
                                    ToString(aLab),
                                    true
                               );
       aPackR.StdPutInFile(aNameRed);
       // std::cout << "RRRReedd === " << aNameRed << "\n";
   }

}
Exemplo n.º 4
0
void cAppliReduc::AmelioHomLocal(cImagH & anIm)
{
    double aPdsLVMStd = 0.1;
    double aPdsFreezC = 100;
    double aPdsEvol = 10;;

    int aNbIterSupl =  3;
    int aMaxIterProgr = 6;

    const std::vector<cLink2Img*> & aVLImC = mImCAmel->VLink();

    for (int aKIm=0 ; aKIm<int(mIms.size()) ; aKIm++)
    {
        mIms[aKIm]->HF()->ReinitHom(cElHomographie::Id());
        mIms[aKIm]->GainLoc() = 0;
        mIms[aKIm]->InitLoc() = false;
    }

    std::vector<cImagH *> aVIms ;

    for (int aKL=0 ; aKL<int(aVLImC.size()) ; aKL++)
    {
         cLink2Img * aLnK = aVLImC[aKL];
         cImagH * anIm = aLnK->Dest();
         anIm->GainLoc() = aLnK->PdsEchant() + 1e-7;
         anIm->C2CI() = true;
         aVIms.push_back(anIm);
         anIm->HF()->ReinitHom(aLnK->Hom12().Inverse());
    }
    mImCAmel->GainLoc() = 1e10;
    mImCAmel->InitLoc() = true;
    mImCAmel->C2CI() = true;
    int aNbIm2Init =  aVIms.size();


   cCmpPtrImOnGain aCmpPtrIm;
   std::sort(aVIms.begin(),aVIms.end(),aCmpPtrIm);

   int aNbIterProgr = std::min(aMaxIterProgr,round_up(aVIms.size()/3.0));
   int aNbIterTot = aNbIterProgr + aNbIterSupl;

   double aErrorIn = ErrorSolLoc();
   if (Show(eShowGlob))
       std::cout << "ERROR IN " <<  aErrorIn << "\n";
   for (int aNbIter =0 ; aNbIter < aNbIterTot ; aNbIter ++)
   {
        if (aNbIter < aNbIterProgr)
        {
            int aK0 = (aNbIter *aNbIm2Init) / aNbIterProgr;
            int aK1 = ((aNbIter+1) *aNbIm2Init) / aNbIterProgr;
            for (int aKIm=aK0; aKIm<aK1 ; aKIm++)
            {
                ElPackHomologue aPack;
                cImagH * anIm =  aVIms[aKIm];
                const std::vector<cLink2Img*> & aVL = anIm->VLink();
                int aNbInit=0;
                for (int aKL=0 ; aKL<int(aVL.size()) ; aKL++)
                {
                     cLink2Img * aLnK = aVL[aKL];
                     cImagH * anI2 = aLnK->Dest();
                     if (anI2->InitLoc())
                     {
                        const std::vector<Pt3dr> &  anEch = aLnK->EchantP1();
                        cElHomographie aH = anI2->HF()->HomCur() * aLnK->Hom12();

                        for (int aKP=0 ; aKP<int(anEch.size()) ; aKP++)
                        {
                            const Pt3dr & aP3d = anEch[aKP];
                            Pt2dr aP1 (aP3d.x,aP3d.y);
                            double aPds = aP3d.z;
                            Pt2dr aP2 = aH.Direct(aP1);
                            aPack.Cple_Add(ElCplePtsHomologues(aP1,aP2,aPds));
                        }
                        aNbInit++;
                     }
                }
                cElHomographie aNewH(aPack,true);
                anIm->HF()->ReinitHom(aNewH);
                if (Show(eShowDetail)) std::cout << anIm->Name() << " : " << aNbInit << "\n";
            }

            for (int aKIm=aK0; aKIm<aK1 ; aKIm++)
            {
                aVIms[aKIm]->InitLoc() = true;
            }
            if (Show(eShowDetail)) std::cout << "==============================\n";
        }


        if (mDoCompensLoc)
        {
            mSetEq.SetPhaseEquation();

            double aSomEr=0;
            double aSomP=0;


             for (int aKIm1=0 ; aKIm1<int(mIms.size()) ; aKIm1++)
             {
                  cImagH * anI1 = mIms[aKIm1];
                  anI1->AddViscositty((anI1== mImCAmel) ? aPdsFreezC : aPdsLVMStd);
                  cElHomographie  aCurH1 = anI1->HF()->HomCur();
                
                  if (anI1->InitLoc())
                  {
                       double aPdsE = aPdsEvol /  anI1->PdsEchant();
                       const std::vector<cLink2Img*> & aVL = anI1->VLink();
                       for (int aKL=0 ; aKL<int(aVL.size()) ; aKL++)
                       {
                            cLink2Img * aLnk = aVL[aKL];
                            cImagH* anI2 = aLnk->Dest();
                            cElHomographie  aCurH2 = anI2->HF()->HomCur();
                            cElHomographie  aCurH2Inv = aCurH2.Inverse();
                            if (anI2->InitLoc())
                            {
                                double aSomRes = 0;
                                double aSomCtrl = 0;
                                cElHomographie aH12 = aLnk->Hom12();
                                const std::vector<Pt3dr> & anEch = aLnk->EchantP1();
                                cEqHomogFormelle * anEq = aLnk->EqHF();
                                int aNbPts =  anEch.size();

                                for (int aKEch = 0 ; aKEch<int(aNbPts) ; aKEch++)
                                {
                                     Pt3dr  aP3d =  anEch[aKEch];
                                     Pt2dr aP1(aP3d.x,aP3d.y);
                                     Pt2dr aP2 = aH12.Direct(aP1);
                                     double aPds = aP3d.z * aPdsE;

                                     Pt2dr aRes = anEq->StdAddLiaisonP1P2(aP1,aP2,aPds,false);
                                     Pt2dr aCtrl = aCurH2Inv.Direct(aCurH1.Direct(aP1)) - aP2;
                                     aSomRes += euclid(aRes);
                                     aSomCtrl += euclid(aCtrl);


                                     double anEr = square_euclid(aRes);

                                     aSomEr+= anEr * aPds;
                                     aSomP+= aPds;
                                }

/*
                            std::cout  << anEq
                                       << " N12=" << anI1->Name() << " " << anI2->Name() 
                                       << " ; RES = " << aSomRes/aNbPts << " Ctrl=" << aSomCtrl/aNbPts << "\n";
*/
                            }
                       }
                  }
              // getchar();

              // anI->HF()->SetModeCtrl(cNameSpaceEqF::eHomFigee);
             }
             if (Show(eShowDetail)) std::cout << "ERR = " << sqrt(aSomEr/aSomP) << "\n";

             mSetEq.SolveResetUpdate();
         }
   }
   for (int aKIm1=0 ; aKIm1<int(mIms.size()) ; aKIm1++)
   {
        cImagH * anI1 = mIms[aKIm1];
        anI1->H2ImC() = anI1->HF()->HomCur();
   }
   double aErrorOut = ErrorSolLoc();
   if (Show(eShowGlob))
      std::cout << "ERROR OUT " <<  aErrorOut << " DELTA=" << aErrorOut - aErrorIn << "\n";
    
    
}
Exemplo n.º 5
0
void cLEqHomOneDist::AddLiaisonOnTop(Pt2dr aP1,Pt2dr aP2,REAL aPds)
{
      mLiaisons.back()->Cple_Add(ElCplePtsHomologues(aP1,aP2,aPds));
}
void cAppliApero::ExportMesuresFromCarteProf
     (
          const cExportMesuresFromCarteProf & anEM,
          const cCartes2Export &              aC,
          cElNuage3DMaille *                  aNuage,
          const ElPackHomologue &             aPackH,
          cPoseCam *                          aPose2Compl,
          const std::string &                 aNameCarte
     )
{
   if (aNameCarte == aPose2Compl->Name())
      return;
   if (  
           (! anEM.KeyAssocLiaisons12().IsInit())
        && (! anEM.KeyAssocLiaisons21().IsInit())
      )
  {
     return;
  }

  cPoseCam * aPoseCarte = PoseFromName(aNameCarte);
  const CamStenope * aCSC = aPoseCarte->CurCam();
  Pt2di aSzIm = aCSC->Sz();

  ElPackHomologue aNewPack;

  for 
  (
       ElPackHomologue::const_iterator itH=aPackH.begin();
       itH!=aPackH.end();
       itH++
  )
  {
      Pt2dr aI1 = aNuage->Plani2Index(itH->P1());
      if (aNuage->IndexHasContenuForInterpol(aI1))
      {
          Pt3dr aPTer = aNuage->PtOfIndexInterpol(aI1);
          Pt2dr aP1 = aCSC->R3toF2(aPTer);
          if ((aP1.x>0) && (aP1.y>0) && (aP1.x<aSzIm.x) && (aP1.y<aSzIm.y))
          {
              aNewPack.Cple_Add(ElCplePtsHomologues(aP1,itH->P2()));
          }
      }
  }

  if (anEM.KeyAssocLiaisons12().IsInit())
  {
     std::string aName =    mDC  
                          + mICNM->Assoc1To2
                            (
                                anEM.KeyAssocLiaisons12().Val(),
                                aNameCarte,
                                aPose2Compl->Name(),
                                true
                            );
     if (anEM.LiaisonModeAdd().Val())
        aNewPack.StdAddInFile(aName);
     else
        aNewPack.StdPutInFile(aName);
  }

  if (anEM.KeyAssocLiaisons21().IsInit())
  {
     std::string aName =    mDC  
                          + mICNM->Assoc1To2
                            (
                                anEM.KeyAssocLiaisons21().Val(),
                                aPose2Compl->Name(),
                                aNameCarte,
                                true
                            );
     aNewPack.SelfSwap();
     if (anEM.LiaisonModeAdd().Val())
        aNewPack.StdAddInFile(aName);
     else
        aNewPack.StdPutInFile(aName);
  }




}
void cMatrCorresp::Normalize
     (
          const cOneModeleAnalytique &      aModele,
          const cGeomDiscFPx &              aGT,
	  cPriseDeVue &               aPDV1,
          const cGeomImage &                aGeom1,
	  cPriseDeVue &               aPDV2,
          const cGeomImage &                aGeom2
     )
{
    const cReCalclCorrelMultiEchelle * aRCCME=GetOnlyUseIt(aModele.ReCalclCorrelMultiEchelle());

    bool isNuage3D = (aModele.TypeModele() == eTMA_Nuage3D);

    // A voir, sans doute un peu severe pour eTMA_Nuage3D
    if (isNuage3D)
    {
         mImZ = Im2D_REAL4(mSz.x,mSz.y,0.0);
	 mTImZ = TIm2D<REAL4,REAL8>(mImZ);
    }
    else
    {
        ELISE_ASSERT
        (
            aGeom1.IsId(),
            "Modele Analytique supose Geom1=Identite "
        );
    }

    double aVXY2[theDimPxMax];
    Pt2di aPRas;
    Im2D_REAL4 aIRCC(mSz.x,mSz.y,0.0);
    for (aPRas.x=0 ; aPRas.x<mSz.x ; aPRas.x++)
    {
        for (aPRas.y=0 ; aPRas.y<mSz.y ; aPRas.y++)
        {
           double aPds = mTImPds.get(aPRas);
           if ( aPds > 0)
           {
               Pt2dr aPTer
                     (
                         mTImX1.get(aPRas)/aPds,
                         mTImY1.get(aPRas)/aPds
                     );
               for (int aK=0; aK<mNBXY2; aK++)
               {
                   aVXY2[aK] = mDXY2[aK][aPRas.y][aPRas.x]/ aPds;
               }

               aGT.PxDisc2PxReel(aVXY2,aVXY2);
               aPTer = aGT.RDiscToR2(aPTer);

	       if (isNuage3D)
	       {
	             Pt3dr aPE = aGeom1.Restit2Euclid(aPTer,aVXY2);
                     mTImX1.oset(aPRas,aPE.x);
                     mTImY1.oset(aPRas,aPE.y);
                     mTImZ.oset(aPRas,aPE.z);
		     if (aPRas.y==0) 
		         std::cout << aPRas.x << "\n";
	       }
	       else
	       {
               
                   Pt2dr aQ1 =  aGeom1.Objet2ImageInit_Euclid(aPTer,aVXY2);
                   Pt2dr aQ2 =  aGeom2.Objet2ImageInit_Euclid(aPTer,aVXY2);


	           if (aRCCME!=0)
	           {
	               bool aMMin = aRCCME->AgregMin().Val();
	               double aCorAgr = aMMin ? 1e10 : 0;
		       int aNb=0;

		       for 
		       (
		           std::list<Pt2di>::const_iterator itScSz=aRCCME->ScaleSzW().begin();
		           itScSz!=aRCCME->ScaleSzW().end();
		           itScSz++
		       )
		       {
                           aNb++;
		           cMC_PairIm * aPair = mPairs[itScSz->x];
		           if (aPair==0)
		           {
	                       mPairs[itScSz->x] = new cMC_PairIm(itScSz->x,aGT,aPDV1,aPDV2);
		               aPair = mPairs[itScSz->x];
		           }
                           double aCor = aPair->Correl(aPTer,itScSz->y,aVXY2);
		           if (aMMin)
		              ElSetMin(aCorAgr,aCor);
                           else
		              aCorAgr += aCor;
		       }

                       if (! aMMin)
		          aCorAgr /= aNb;

                       aIRCC.data()[aPRas.y][aPRas.x] = (REAL4)aCorAgr;
                       // std::cout << "COR = " << aCorAgr << "\n";
		       if (aCorAgr < aRCCME->Seuil() )
		       {
                          aPds =  0;
		          mTImPds.oset(aPRas,0);
		       }
	           }

                   if (aPds > 0)
	           {
                      mPackHomInit.Cple_Add(ElCplePtsHomologues(aQ1,aQ2,aPds));

                      aQ1 =  aGeom2.CorrigeDist1(aQ1);
                      aQ2 =  aGeom2.CorrigeDist2(aQ2);
                      mPackHomCorr.Cple_Add(ElCplePtsHomologues(aQ1,aQ2,aPds));
                  }
	      }
           }
        }
    }


    if (aRCCME && (aRCCME->DoImg().Val()))
    {
        std::string aName=   mAppli.FullDirResult()
	                   + std::string("CorME_")
	                   + mAppli.NameChantier()
			   + std::string(".tif");
        Tiff_Im::Create8BFromFonc(aName,aIRCC.sz(),Max(0,Min(255,128*(1+aIRCC.in()))));

    }
}
Exemplo n.º 8
0
cElHomographie  cElHomographie::RobustInit(double & aDMIn,double * aQuality,const ElPackHomologue & aPack,bool & Ok ,int aNbTestEstim, double aPerc,int aNbMaxPts)
{
   cElHomographie aRes = cElHomographie::Id();
   Ok = false;
   Pt2dr aCdg(0,0);
   for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++)
   {
       aCdg = aCdg + itH->P1();
   }

   aCdg = aCdg / double(aPack.size());
   
   std::vector<std::pair<Pt2dr,Pt2dr> > aV00;
   std::vector<std::pair<Pt2dr,Pt2dr> > aV01;
   std::vector<std::pair<Pt2dr,Pt2dr> > aV10;
   std::vector<std::pair<Pt2dr,Pt2dr> > aV11;
   std::vector<std::pair<Pt2dr,Pt2dr> > aVAll;

   int aNbPtsTot = aPack.size();


   int aCpt = 0;
   for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++)
   {
        Pt2dr aP1 = itH->P1();
        Pt2dr aP2 = itH->P2();
        std::pair<Pt2dr,Pt2dr> aPair(aP1,aP2);

        if (  (((aCpt-1)*aNbMaxPts)/aNbPtsTot)  !=  ((aCpt*aNbMaxPts)/aNbPtsTot))
        {
            aVAll.push_back(aPair);
        }

        if (aP1.x < aCdg.x)
        {
            if (aP1.y < aCdg.y) aV00.push_back(aPair);
            else                aV01.push_back(aPair);
        }
        else
        {
            if (aP1.y < aCdg.y) aV10.push_back(aPair);
            else                aV11.push_back(aPair);
        }
        aCpt++;
   }


   if (aV00.empty()  || aV01.empty()  || aV10.empty()  || aV11.empty()  )
      return aRes;


   aDMIn = 1e30;
   int aNbPts = aVAll.size();
   int aNbKth = ElMax(1,ElMin(aNbPts-1,round_ni((aPerc/100.0) * aNbPts)));
   std::vector<double> aVDist;

   if (aNbMaxPts<aNbPtsTot)
      aNbTestEstim = (aNbTestEstim*aNbPtsTot) / aNbMaxPts;

   // int aKMIN = -1;
   std::vector<double> aVD; // For tuning and show in if(0) ...
   while (aNbTestEstim)
   {
       int aK00 = NRrandom3(aV00.size());
       int aK01 = NRrandom3(aV01.size());
       int aK10 = NRrandom3(aV10.size());
       int aK11 = NRrandom3(aV11.size());

       ElPackHomologue aP4;
       AddPair(aP4,aV00[aK00]);
       AddPair(aP4,aV01[aK01]);
       AddPair(aP4,aV10[aK10]);
       AddPair(aP4,aV11[aK11]);

       cElHomographie aSol = cElHomographie(aP4,true);

       aVDist.clear();
       for (int aK=0 ; aK< aNbPts ; aK++)
       {
          Pt2dr aP1 = aVAll[aK].first;
          Pt2dr aP2 = aVAll[aK].second;

/*
          Pt2dr aDif = aP2 -aSol.Direct(aP1);
          double aDx = ElAbs(aDif.x);
          double aDy = ElAbs(aDif.y);
          double aDist =  (aDx+aDy + ElMax(aDx,aDy))/ 2.0;
*/
          double aDist = QuickDist(aP2 -aSol.Direct(aP1));
          aVDist.push_back(aDist);
       }
       
       double aSom = MoyKPPVal(aVDist,aNbKth);
       
       aVD.push_back(aSom);

       //std::cout << "Robust:Hom:SOM = " << aDMIn << " " << aSom << "\n";

       if (aSom <aDMIn)
       {
          aRes = aSol;
          aDMIn = aSom;
       }
       aNbTestEstim--;
   }


   // double aDMinInit = aDMIn;
   ElPackHomologue aPckPds;
   for (int anIterL2 = 0 ; anIterL2 < 4 ; anIterL2++)
   {
       aPckPds = ElPackHomologue();
       aVDist.clear();
       int aCpt = 0;
       for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++)
       {
           Pt2dr aP1 = itH->P1();
           Pt2dr aP2 = itH->P2();
           double aDist = QuickDist(aP2 -aRes.Direct(aP1));
           aVDist.push_back(aDist);

           double aPds = 1/ (1+ 4*ElSquare(aDist/aDMIn));
           aPckPds.Cple_Add(ElCplePtsHomologues(aP1,aP2,aPds));
           aCpt++;
       }
       ELISE_ASSERT(aNbPtsTot==aPack.size() ,"KKKKK ????");
       int aKTh = round_ni(aNbPtsTot * (aPerc/100.0));

       ELISE_ASSERT(int(aVDist.size())==aNbPtsTot,"Compat MoyKPPVal/SplitArrounKthValue");
       aDMIn = MoyKPPVal(aVDist,aKTh);

       aRes = cElHomographie(aPckPds,true);
   }

   if (aQuality)
   {
      std::vector<double> aVEstim;
      int aNbTestValid = 71;
      for (int aKTest = 0 ; aKTest <aNbTestValid ; aKTest++)
      {
          ElPackHomologue aPckPdsA;
          ElPackHomologue aPckPdsB;
          cRandNParmiQ  aSelec(aNbPtsTot/2,aNbPtsTot);

          for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++)
          {
              Pt2dr aP1 = itH->P1();
              Pt2dr aP2 = itH->P2();
              double aDist = QuickDist(aP2 -aRes.Direct(aP1));
              aVDist.push_back(aDist);

              double aPds = 1/ sqrt(1+ ElSquare(aDist/aDMIn));
              // if (NRrandom3() > 0.5) 
              if (aSelec.GetNext())
                  aPckPdsA.Cple_Add(ElCplePtsHomologues(aP1,aP2,aPds));
              else
                  aPckPdsB.Cple_Add(ElCplePtsHomologues(aP1,aP2,aPds));

           
          }
          cElHomographie aResA = cElHomographie(aPckPdsA,true);
          cElHomographie aResB = cElHomographie(aPckPdsB,true);

          double aSomDist = 0; 
          for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++)
          {
              Pt2dr aP1 = itH->P1();

              Pt2dr  aQ   = aRes.Direct(aP1);
              Pt2dr  aQA  = aResA.Direct(aP1);
              Pt2dr  aQB  = aResB.Direct(aP1);
              double aDist = (QuickDist(aQ-aQA) + QuickDist(aQ-aQB) + QuickDist(aQB-aQA)) / 3.0;
              aSomDist += aDist;
          }
          aSomDist /= aNbPtsTot;
          aVEstim.push_back(aSomDist);
      }
      *aQuality  = MedianeSup(aVEstim);
   }


   Ok= true;
   return aRes;
}
Exemplo n.º 9
0
void AddPair(ElPackHomologue & aPack,const std::pair<Pt2dr,Pt2dr> &aPair)
{
   aPack.Cple_Add(ElCplePtsHomologues(aPair.first,aPair.second));
}
Exemplo n.º 10
0
void cElHomographie::AddForInverse(ElPackHomologue & aPack,Pt2dr aP) const
{
   aPack.Cple_Add(ElCplePtsHomologues(Direct(aP),aP,1.0));
}
Exemplo n.º 11
0
void cAppliTiepRed::DoExport()
{


    int aNbCam = mVecCam.size();
    std::vector<std::vector<ElPackHomologue> > aVVH (aNbCam,std::vector<ElPackHomologue>(aNbCam));
    for (std::list<tPMulTiepRedPtr>::const_iterator itP=mListSel.begin(); itP!=mListSel.end();  itP++)
    {
         tMerge * aMerge = (*itP)->Merge();
         const std::vector<Pt2dUi2> &  aVE = aMerge->Edges();
         for (int aKCple=0 ; aKCple<int(aVE.size()) ; aKCple++)
         {
              int aKCam1 = aVE[aKCple].x;
              int aKCam2 = aVE[aKCple].y;
              cCameraTiepRed * aCam1 = mVecCam[aKCam1];
              cCameraTiepRed * aCam2 = mVecCam[aKCam2];

              /*
                  if ((aCam1->NameIm() == "Abbey-IMG_0207.jpg") && (aCam2->NameIm() == "Abbey-IMG_0206.jpg"))
                  {
                     std::cout << "cAppliTiepRed::DoExportcAppliTiepRed::DoExport\n";
                  }
              */


              Pt2df aP1 = aMerge->GetVal(aKCam1);
              Pt2df aP2 = aMerge->GetVal(aKCam2);

              Pt2dr aQ1 = aCam1->Hom2Cam(aP1);
              Pt2dr aQ2 = aCam2->Hom2Cam(aP2);

              aVVH[aKCam1][aKCam2].Cple_Add(ElCplePtsHomologues(aQ1,aQ2));
              // Symetrisation
              aVVH[aKCam2][aKCam1].Cple_Add(ElCplePtsHomologues(aQ2,aQ1));

              if (VerifNM())
              {
                   // Pt2dr aW1 = mNM->CalibrationCamera(aCam1->NameIm());
                   // std::cout << "FFFFffGG  :" << mNM->CalibrationCamera(aCam1->NameIm())->Radian2Pixel(Pt2dr(aP1.x,aP1.y)) - aQ1 << "\n";
              }
               

              Verif(aP1);
              Verif(aP2);
         }
    }

    int aSomH=0;
    for (int aKCam1=0 ; aKCam1<aNbCam ; aKCam1++)
    {
        for (int aKCam2=0 ; aKCam2<aNbCam ; aKCam2++)
        {
             const ElPackHomologue & aPack = aVVH[aKCam1][aKCam2];
             aSomH += aPack.size();
             if (aPack.size())
             {
                  aPack.StdPutInFile(NameHomol(mVecCam[aKCam1]->NameIm(),mVecCam[aKCam2]->NameIm(),mKBox));
             }
        }
    }
}