Beispiel #1
0
int TestMTD_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv,1);

    std::string  aNameIm;

    ElInitArgMain
    (
    argc,argv,
    LArgMain()  << EAMC(aNameIm,"Image name", eSAM_IsPatFile),
    LArgMain()
    );

    if (MMVisualMode) return EXIT_SUCCESS;

    std::string aDir,aPat;
    SplitDirAndFile(aDir,aPat,aNameIm);
    cInterfChantierNameManipulateur::BasicAlloc(aDir);


    cMetaDataPhoto aMTD =  cMetaDataPhoto::CreateExiv2(aNameIm);

    std::cout << "FocMm " << aMTD.FocMm(true) << "\n";
    std::cout << "Foc35 " << aMTD.Foc35(true) << "\n";
    std::cout << "Cam   [" << aMTD.Cam(true) << "]\n";


    return 1;
}
cAppli_MPI2Ply::cAppli_MPI2Ply(int argc,char ** argv):
    mDS (1.0)
{
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(mName,"Dir or PMI-Type (QuickMac ....)",eSAM_None,ListOfVal(eNbTypeMMByP)),
        LArgMain()
        << EAM(mDS,"DS",true,"Dowscale, Def=1.0")
        << EAM(mMergeOut,"Out",true,"Ply File Results")
        << EAM(mPat,"Pat",true,"Pattern for selecting images (Def=All image in files)",eSAM_IsPatFile)
    );

    if(MMVisualMode) return;

    mCFPI = new cChantierFromMPI(mName,mDS,mPat);

    mComNuageMerge =       MM3dBinFile("TestLib  MergeCloud ")
                           +   mCFPI-> mStrImOri0
                           + " ModeMerge=" + mCFPI->mStrType
                           + " DownScale=" +ToString(mDS)
                           + " SzNorm=3"
                           + " PlyCoul=true"
                           ;

    std::string aPatPly = "Nuage-Merge-" +mPat + ".*.ply";


    if (! EAMIsInit(&mMergeOut)) mMergeOut =  mCFPI->mFullDirChantier+"C3DC_"+ mCFPI->mStrType + ".ply";
    mComCatPly =  MM3dBinFile("MergePly ") + QUOTE( mCFPI->mFullDirPIm + aPatPly) + " Out="  + mMergeOut;

}
int AperoProg_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv);

    std::string aFullDir= "";
    std::string AeroIn= "";
    std::string AeroOut="";


    /*double aSigmaTieP = 1;
    double aFactResElimTieP = 5;
    double Viscos = 1.0;
    bool ExpTxt = false;*/

    ElInitArgMain
    (
         argc,argv,
         LArgMain()  << EAMC(aFullDir,"Full Directory (Dir+Pattern)", eSAM_IsPatFile)
                     << EAMC(AeroIn,"Input Orientation", eSAM_IsExistDirOri)
                     << EAMC(AeroOut,"Output Orientation", eSAM_IsOutputDirOri),
         LArgMain()
    );
    if (!MMVisualMode)
    {
        std::string aDir,aPat;
    #if (ELISE_windows)
         replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
    #endif
        SplitDirAndFile(aDir,aPat,aFullDir);
        StdCorrecNameOrient(AeroIn,aDir);
    }

    return EXIT_SUCCESS;
}
Beispiel #4
0
int XeresMergeTieP_Main(int argc,char** argv)
{
   MMD_InitArgcArgv(argc,argv);

   std::vector<std::string> aVSeq;
   std::string aDir="./";
   std::string aPostMerge;

   ElInitArgMain
   (
         argc,argv,
         LArgMain()  << EAMC(aVSeq, "Sequence"),
         LArgMain()  << EAM(aDir,"Dir",true,"Folder of data, Def=./")
                     << EAM(aPostMerge,"Postfix of merged folder")
   );

   if (! EAMIsInit(&aPostMerge))
   {
        aPostMerge = "Merge-" + aVSeq[0];
   }

   std::vector<cAppliXeres *> aVAp;
   for (int aK=0 ; aK<int(aVSeq.size()) ; aK++)
   {
        aVAp.push_back(new cAppliXeres (aDir,aVSeq[aK]));
   }

   cAppliXeres::FusionneHom(aVAp,aPostMerge);

   return EXIT_SUCCESS;
}
int DigitalGlobe2Grid_main(int argc, char **argv)
{
    std::string aNameFile; // .RPB file from Digital Globe
    std::string inputSyst = "+proj=longlat +datum=WGS84 "; //input syst proj4
    std::string targetSyst;//output syst proj4
	std::string refineCoef="";
    bool binaire = true;
    double altiMin, altiMax;
    int nbLayers;

    double stepPixel = 100.f;
    double stepCarto = 50.f;

    ElInitArgMain
        (
        argc, argv,
        LArgMain() << EAMC(aNameFile, "RPB from DigitalGlobe file")
        << EAMC(altiMin, "min altitude (ellipsoidal)")
        << EAMC(altiMax, "max altitude (ellipsoidal)")
        << EAMC(nbLayers, "number of layers (min 4)")
        << EAMC(targetSyst, "targetSyst - target system in Proj4 format (ex : \"+proj=utm +zone=32 +north +datum=WGS84 +units=m +no_defs\""),
        LArgMain()
        //caracteristique du systeme geodesique saisies sans espace (+proj=utm +zone=10 +north +datum=WGS84...)
        << EAM(stepPixel, "stepPixel", true, "Step in pixel (Def=100pix)")
        << EAM(stepCarto, "stepCarto", true, "Step in m (carto) (Def=50m)")
        << EAM(refineCoef, "refineCoef", true, "File of Coef to refine Grid")
        << EAM(binaire, "Bin", true, "Export Grid in binaries (Def=True)")
        );

    //Reading Inverse RPC, computing Direct RPC and setting up RPC object
    RPC aRPC;
    aRPC.ReadRPB(aNameFile);
    cout << "RPB File read" << endl;

	//Generating a 50*50*50 grid on the normalized space with random normalized heights
	Pt3di aGridSz(50, 50, 50);
	vector<Pt3dr> aGridGeoNorm = aRPC.GenerateNormGrid(aGridSz);//50 is the size of grid for generated GCPs (50*50)

	//Converting the points to image space
	vector<Pt3dr> aGridImNorm;
	for (u_int i = 0; i < aGridGeoNorm.size(); i++)
	{
		aGridImNorm.push_back(aRPC.InverseRPCNorm(aGridGeoNorm[i]));
	}
	
	aRPC.GCP2Direct(aGridGeoNorm, aGridImNorm);
    cout << "Direct RPC estimated" << endl;
    aRPC.ReconstructValidity();
    aRPC.info();



    //Computing Grid
    std::string aNameIm = StdPrefix(aNameFile) + ".TIF";
    aRPC.RPC2Grid(nbLayers, altiMin, altiMax, refineCoef, aNameIm, stepPixel, stepCarto, targetSyst, inputSyst, binaire);


    return EXIT_SUCCESS;
}
int GCPCtrl_main(int argc,char ** argv)
{
    // MemoArg(argc,argv);
    MMD_InitArgcArgv(argc,argv);
    std::string  aDir,aPat,aFullDir;


    std::string AeroIn;
    std::string DicoPts;
    std::string MesureIm;
    bool        CPI = false;
    bool ShowUnused = true;


    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aFullDir,"Full name (Dir+Pat)", eSAM_IsPatFile)
                    << EAMC(AeroIn,"Orientation in", eSAM_IsExistDirOri)
                    << EAMC(DicoPts,"Ground Control Points File", eSAM_IsExistFile)
                    << EAMC(MesureIm,"Image Measurements File", eSAM_IsExistFile),
        LArgMain()
                    <<  EAM(CPI,"CPI",true,"when Calib Per Image has to be used", eSAM_IsBool)
                    <<  EAM(ShowUnused,"ShowU",true,"Show unused point (def=true)", eSAM_IsBool)
    );

    if (!MMVisualMode)
    {
    #if (ELISE_windows)
        replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
    #endif
    SplitDirAndFile(aDir,aPat,aFullDir);
    StdCorrecNameOrient(AeroIn,aDir);



    std::string aCom =   MM3dBinFile_quotes( "Apero" )
                       + ToStrBlkCorr( MMDir()+"include/XML_MicMac/Apero-GCP-Control.xml" )+" "
                       + std::string(" DirectoryChantier=") +aDir +  std::string(" ")
                       + std::string(" +PatternAllIm=") + QUOTE(aPat) + std::string(" ")
                       + std::string(" +AeroIn=") + AeroIn
                       + std::string(" +DicoApp=") +  DicoPts
                       + std::string(" +SaisieIm=") +  MesureIm
                    ;

    if (EAMIsInit(&ShowUnused)) aCom = aCom + " +ShowUnused=" + ToString(ShowUnused);
    if (CPI) aCom += " +CPI=true ";


    std::cout << "Com = " << aCom << "\n";
    int aRes = System(aCom.c_str(),false,true,true);


    return aRes;

    }
    else return EXIT_SUCCESS;
}
Beispiel #7
0
int TD_Exemple_main(int argc,char ** argv)
{
    std::string aNameCam,aNameAppuis;
    std::string toto;

    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aNameCam,"Name of camera")
                    << EAMC(aNameAppuis,"Name of GCP"),
        LArgMain()  << EAM(toto,"toto",true,"Do no stuff")
    );

	//On créé un objet camera (aCam) et un objet liste de points d'appui (aSetGCP)
    cTD_Camera aCam(aNameCam);
    cTD_SetAppuis aSetGCP(aNameAppuis);

	//Pour chaque point d'appui, on calcul la distance entre la coordonnée image données par le fichier et la coordonnée image projetée à partir du point 3D et des infos de camera
    for (int aKP=0 ; aKP<int(aSetGCP.PTer().size()) ; aKP++)
    {
         Pt3dr aPTer = aSetGCP.PTer()[aKP];//Point 3D
         Pt2dr aPIm  = aSetGCP.PIm()[aKP];//Point image

         Pt2dr aPProj = aCam.Ter2Image(aPTer);//Point projeté

         std::cout  << "dist[" << aKP << "]= " << euclid (aPIm,aPProj) << "\n";
    }

	//On créé 3 int correspondant à des identifiants de points d'appui
    int aK1,aK2,aK3;
    std::cout << "ENTER K1 K2 K3 \n";
    cin >>  aK1 >> aK2 >>  aK3;
	//Avec ces 3 points, on calcule les positions et orientations possibles de la caméra
	
    std::vector<cTD_Camera> aSols = aCam.RelvtEspace
                                    (
                                          aSetGCP.PTer()[aK1], aSetGCP.PIm()[aK1],
                                          aSetGCP.PTer()[aK2], aSetGCP.PIm()[aK2],
                                          aSetGCP.PTer()[aK3], aSetGCP.PIm()[aK3]
                                    );

	//Pour chaque solution, on calcul la distance entre la coordonnée image données par le fichier et la coordonnée image projetée à partir du point 3D et des infos calculées
    for (int aKS=0 ; aKS<int(aSols.size()) ; aKS++)
    {
         for (int aKP=0 ; aKP<int(aSetGCP.PTer().size()) ; aKP++)
         {
              Pt3dr aPTer = aSetGCP.PTer()[aKP];
              Pt2dr aPIm  = aSetGCP.PIm()[aKP];

              Pt2dr aPProj = aSols[aKS].Ter2Image(aPTer);

              std::cout  << "   dist " << euclid (aPIm,aPProj) << "\n";
         }
         std::cout << "========================================\n";
    }

    return 0;
}
void PartitionRenato(int argc,char** argv)
{
    std::string aName;
    double  aPropSzW=0.1,aSeuil=75;
    double aPropExag = 0.1;
    int aNbIter = 3;
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aName,"Name Input"),
        LArgMain()  <<  EAM(aPropSzW,"PropSzW",true,"Prop Size of W, def =0.1")
                     <<  EAM(aSeuil,"Seuil",true,"Threshold beetween Black & White, Def=75")
    );
    

    Tiff_Im aTIn = Tiff_Im::UnivConvStd(aName);
    Pt2di aSz = aTIn.sz();
    int aSzW = round_ni((euclid(aSz)*aPropSzW) / sqrt(aNbIter));
    Im2D_REAL4 anIm0(aSz.x,aSz.y);
    Im2D_REAL4 anIm1(aSz.x,aSz.y);
    Im2D_U_INT1 aImInside(aSz.x,aSz.y,1);

    ELISE_COPY(anIm0.all_pts(),255-aTIn.in(),anIm0.out());

    int aNbF = 3;
    for (int aKF=0 ; aKF<aNbF ; aKF++)
    {
        Im2D_REAL4 anImFond(aSz.x,aSz.y);
        Fonc_Num aFIn = anIm0.in(0);
        for (int aK=0 ; aK<aNbIter ; aK++)
           aFIn = (rect_som(aFIn,aSzW)*aImInside.in(0)) / Max(1.0,rect_som(aImInside.in(0),aSzW));

       ELISE_COPY(anImFond.all_pts(),aFIn,anImFond.out());
       if (aKF == (aNbF-1))
       {
              Fonc_Num aF = anIm0.in()-anImFond.in();
              aF = aF / aSeuil;
              aF = (aF -0.1) / (1-2*aPropExag);
              aF = Max(0.0,Min(1.0,aF));
              ELISE_COPY(anIm1.all_pts(),255.0 *(1-aF),anIm1.out());
       }
       else
       {
            ELISE_COPY
            (
                 aImInside.all_pts(),
                 anIm0.in() < anImFond.in()+aSeuil,
                 aImInside.out()
            );
       }
       
    }
    


    Tiff_Im::Create8BFromFonc(std::string("Bin-")+StdPrefix(aName)+".tif",aTIn.sz(),anIm1.in());
}
int SplitMPO_main(int argc,char ** argv)
{
     std::string aFullName;
     std::string aPostR = "_R";
     std::string aPostL = "_L";
     bool DoTifGray = false;


     ElInitArgMain
     (
           argc,argv,
           LArgMain() << EAMC(aFullName,"Full name (Dir+Pat)", eSAM_IsPatFile) ,
           LArgMain() << EAM(aPostR,"Right",true,"Right extension, def=_R")
                  << EAM(aPostL,"Left",true,"Left extension, def=_L")
                  << EAM(DoTifGray,"TG",true,"Tiff gray, def=false")
    );

    std::string aDir,aPat;
    SplitDirAndFile(aDir,aPat,aFullName);

    cInterfChantierNameManipulateur * aICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
    const std::vector<std::string> * aSetIm = aICNM->Get(aPat);



    for (int aKIm=0 ; aKIm<int(aSetIm->size()) ; aKIm++)
    {
        std::string aNameIn = (*aSetIm)[aKIm];
        for (int aK=0 ; aK<2 ; aK++)
        {
            std::string aPref = StdPrefix(aNameIn);
            std::string aPost = StdPostfix(aNameIn);
            std::string aNameOut = aPref+((aK==0)? aPostL : aPostR) + ".jpg";

            std::string aCom = "exiftool ";
             if (aK==0)
                aCom = aCom + "-trailer:all= " + aNameIn  + " -o " + aNameOut;
             else
               aCom = aCom+ aNameIn + " -mpimage2 -b> " + aNameOut;

             std::cout << aCom << "\n";
             VoidSystem(aCom.c_str());
             if (DoTifGray)
             {
                aCom =    "convert "
                       +  aNameOut
                       +  " -compress None -depth 8  -colorspace Gray "
                       +  StdPrefix(aNameOut) + "_Gray.tif";
                std::cout << aCom << "\n";
                VoidSystem(aCom.c_str());
             }
        }
    }

    return 1;
}
Beispiel #10
0
cAppli_MPI2Mnt::cAppli_MPI2Mnt(int argc,char ** argv) :
    mDS       (1.0),
    mDeZoom   (2),
    mDirMTD   ("PIMs-TmpMnt/"),
    mDirBasc   ("PIMs-TmpBasc/"),
    mNameMerge ("PIMs-Merged.xml"),
    mNameOriMerge ("PIMs-ZNUM-Merged.xml"),
    mNameOriMasq ("PIMs-Merged_Masq.xml"),
    mRepIsAnam   (false),
    mDoMnt       (true),
    mDoOrtho     (false),
    mMasqImGlob (""),
    mDebug       (false)
{
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(mName,"Dir or PMI-Type (QuickMac ....)",eSAM_None,ListOfVal(eNbTypeMMByP)),  //pas gerable par les vCommandes...
        LArgMain()
        << EAM(mDS,"DS",true,"Downscale, Def=1.0")
        << EAM(mRep,"Repere",true,"Repair (Euclid or Cyl)",eSAM_IsExistFileRP)
        << EAM(mPat,"Pat",true,"Pattern, def = all existing clouds", eSAM_IsPatFile)
        << EAM(mDoMnt,"DoMnt",true," Compute DTM , def=true (use false to return only ortho)")
        << EAM(mDoOrtho,"DoOrtho",true,"Generate ortho photo,  def=false")
        << EAM(mMasqImGlob,"MasqImGlob",true,"Global Masq for ortho: if used, give full name of masq (e.g. MasqGlob.tif) ",eSAM_IsExistFileRP)
        << EAM(mDebug,"Debug",true,"Debug !!!",eSAM_InternalUse)
    );

    if (mDoOrtho && (!EAMIsInit(&mDoMnt))) mDoMnt = mDoOrtho;

    if (MMVisualMode) return;

    mCFPI = new cChantierFromMPI(mName,mDS,mPat);
    mDirApp = mCFPI->mFullDirChantier;
    mICNM = cInterfChantierNameManipulateur::BasicAlloc(mDirApp);
    mSetIm = mICNM->Get(mCFPI->mStrPat);

    if (EAMIsInit(&mRep))
    {
        bool IsOrthoXCSte=false;
        bool IsAnamXCsteOfCart=false;
        mRepIsAnam = RepereIsAnam(mDirApp+mRep,IsOrthoXCSte,IsAnamXCsteOfCart);
    }

    ELISE_fp::MkDirSvp(mDirApp+mDirBasc);


    if (EAMIsInit(&mRep))
        mStrRep = " Repere=" + mRep;
    // cMMByImNM *    mMMI;


    mTargetGeom = mDirApp+mDirMTD+ TheStringLastNuageMM ;

}
Beispiel #11
0
int MakeGrid_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv);

    NoInit = "XXXXXXXXXX";

    MemoArg(argc,argv);
    std::string  aDir,aPat,aFullDir;

    std::string AeroIn;
    std::string AeroOut;
    //std::vector<std::string> ImPl;

    ElInitArgMain
    (
    argc,argv,
    LArgMain()  << EAMC(aFullDir, "Full Directory (Dir+Pattern)", eSAM_IsPatFile)
                    << EAMC(AeroIn, "Input Orientation", eSAM_IsExistDirOri),
    LArgMain()
                    << EAM(AeroOut,"Out",true)
    );

    if (!MMVisualMode)
    {
        if (AeroOut=="")
           AeroOut = "Grid-"+AeroIn;

        #if (ELISE_windows)
            replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
        #endif
        SplitDirAndFile(aDir,aPat,aFullDir);


    #if (ELISE_windows)
        std::string aCom =     MMDir() + std::string("bin\\Apero ")
    #else
        std::string aCom =     MMDir() + std::string("bin/Apero ")
    #endif
                           +  MMDir() + std::string("include/XML_MicMac/AperoGrid.xml ")
                           + std::string(" DirectoryChantier=") +aDir +  std::string(" ")
                           + std::string(" +PatternAllIm=") + QUOTE(aPat) + std::string(" ")
                           + std::string(" +AeroOut=-") + AeroOut
                           + std::string(" +AeroIn=-") + AeroIn
                        ;

       std::cout << "Com = " << aCom << "\n";
       int aRes = system_call(aCom.c_str());


       return aRes;
    }
    else
        return EXIT_SUCCESS;
}
cAppliOptimTriplet::cAppliOptimTriplet(int argc,char ** argv,bool QuitExist)  :
    mDir      ("./"),
    // mNbMaxSel (StdDefNbMaxSel),
    mShow     (true),
    mQuick    (false),
    mPrefHom   (""),
    mQuitExist (QuitExist),
    m3S        ("a","b","c"),
    mNoIm1     (0),
    mNoIm2     (0)
{
   ElInitArgMain
   (
        argc,argv,
        LArgMain() << EAMC(mN1,"Image one", eSAM_IsExistFile)
                   << EAMC(mN2,"Image two", eSAM_IsExistFile)
                   << EAMC(mN3,"Image three", eSAM_IsExistFile),
        LArgMain() << EAM(mNameOriCalib,"OriCalib",true,"Orientation for calibration ", eSAM_IsExistDirOri)
                   << EAM(mDir,"Dir",true,"Directory, Def=./ ",eSAM_IsDir)
                   << EAM(mSzShow,"SzShow",true,"Sz of window to show the result in window (Def=none)")
                   << EAM(mNbMaxSel,"NbPts",true,"Nb of selected points")
                   << EAM(mShow,"Show",true,"Show Message")
                   << EAM(mQuick,"Quick",true,"Quick version")
                   << EAM(mPrefHom,"PrefHom",true,"Prefix Homologous points, def=\"\"")
   );


   m3S = cTplTriplet<std::string> (mN1,mN2,mN3);

   std::string aNameMin = (mN1<mN2) ? mN1 : mN2;
   std::string aNameMax = (mN1>mN2) ? mN1 : mN2;

   mNM = new cNewO_NameManager(mPrefHom,mQuick,mDir,mNameOriCalib,"dat");
   mNoIm1 = new cNewO_OneIm(*mNM,aNameMin);
   mNoIm2 = new cNewO_OneIm(*mNM,aNameMax);

   if (mN3== KeyCple )
   {
      std::string  aNameLON = mNM->NameTripletsOfCple(mNoIm1,mNoIm2,true);
      cListOfName aLON  = StdGetFromPCP(aNameLON,ListOfName);
      for (std::list<std::string>::const_iterator itN =aLON.Name().begin() ; itN!=aLON.Name().end() ; itN++)
      {
         mN3 = *itN;
         m3S = cTplTriplet<std::string> (mN1,mN2,mN3);
         Execute();
      }
   }
   else
   {
      mQuitExist = false;
      Execute();
   }
}
cAppli_Martini::cAppli_Martini(int argc,char ** argv,bool Quick) :
    mExe   (true),
    mQuick (Quick)
{
   ElInitArgMain
   (
        argc,argv,
        LArgMain() << EAMC(mPat,"Image Pat", eSAM_IsPatFile),
        LArgMain() << EAM(mNameOriCalib,"OriCalib",true,"Orientation for calibration ", eSAM_IsExistDirOri)
                   << EAM(mExe,"Exe",true,"Execute commands, def=true (if false, only print)")
                   // << EAM(mQuick,"Quick",true,"Quick version")
   );
}
Beispiel #14
0
int ChgSysCo_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv);

    std::string aFullDir= "";
    std::string AeroIn= "";
    std::string aStrChSys="";
    std::string AeroOut="";
    bool        ForceRot = false;


    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aFullDir,"Full Directory (Dir+Pattern)", eSAM_IsPatFile)
                    << EAMC(AeroIn,"Input Orientation", eSAM_IsExistDirOri)
                    << EAMC(aStrChSys,"Change coordinate file", eSAM_IsExistFile)
                    << EAMC(AeroOut,"Output Orientation", eSAM_IsOutputDirOri),
        LArgMain()  << EAM(ForceRot,"FR",true,"Force orientation matrix to be pure rotation (Def = true)", eSAM_IsBool)
    );

    if (!MMVisualMode)
    {
        std::string aDir,aPat;
    #if (ELISE_windows)
        replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
    #endif
        SplitDirAndFile(aDir,aPat,aFullDir);
        StdCorrecNameOrient(AeroIn,aDir);

        std::cout << "DPPPP= " << aDir << " " << aPat << "\n";



        std::string aCom =       MM3dBinFile( "Apero" )
                              +  XML_MM_File("Apero-ChCo.xml")
                              +  std::string(" DirectoryChantier=") + aDir + " "
                              +  std::string(" +SetIm=") + aPat + " "
                              +  std::string(" +AeroIn=-") + AeroIn + " "
                              +  std::string(" +AeroOut=-") + AeroOut + " "
                              +  std::string(" +ChC=") + aStrChSys + " "
                              +  std::string(" +ChCFR=") + ToString(ForceRot)
                           ;


       std::cout << "COM = " << aCom << "\n";
       int aRes = system_call(aCom.c_str());
       return aRes;
    }
    else return EXIT_SUCCESS;
}
int MMAllAuto_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv);

    std::string  aDir,aPat,aFullDir;
    std::string  AeroIn;
    int          aZoomF = 2;


    ElInitArgMain
    (
    argc,argv,
    LArgMain()  << EAMC(aFullDir,"Dir + Pattern", eSAM_IsPatFile)
                    << EAMC(AeroIn,"Orientation", eSAM_IsExistDirOri),
    LArgMain()
                    << EAM(aZoomF,"ZoomF",true,"Zoom Final, def=2",eSAM_IsPowerOf2)
    );

#if (ELISE_windows)
    replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
#endif
    SplitDirAndFile(aDir,aPat,aFullDir);
    StdCorrecNameOrient(AeroIn,aDir);

    cInterfChantierNameManipulateur * aICNM =  cInterfChantierNameManipulateur::BasicAlloc(aDir);

    // Genere les pyramides pour que le paral ne s'ecrase pas les 1 les autres

    const cInterfChantierNameManipulateur::tSet * aSetIm = aICNM->Get(aPat);


    for (int aKIm=0 ; aKIm<int(aSetIm->size()) ; aKIm++)
    {
        std::string aCom =   MM3dBinFile("MICMAC")
                              + XML_MM_File("MM-AllAuto.xml")
                              + std::string(" WorkDir=") +aDir +  std::string(" ")
                              + std::string(" +Im1=") + QUOTE((*aSetIm)[aKIm]) + std::string(" ")
                              + std::string(" +Ori=-") + AeroIn
                              + std::string(" +ZoomF=") + ToString(aZoomF)
                    ;



        system_call(aCom.c_str());
  }

 // int aRes = system_call(aCom.c_str());


   return 0;
}
Beispiel #16
0
int XeresCalibMain_main(int argc,char** argv)
{
   MMD_InitArgcArgv(argc,argv);

   std::string aSeq,aDir,OutCal="Calib";
   int aSz=1500;



   ElInitArgMain
   (
         argc,argv,
         LArgMain()  //  << EAMC(aSeq, "Sequence")
                     << EAMC(aDir, "Directory"),
         LArgMain()  << EAM(aSeq,"Seq",true,"Folder of data, Def=./")
                     << EAM(aSz,"Sz",true,"Sz of TieP, Def=1500")
                     << EAM(OutCal,"Out",true,"")
   );

   // std::string aCdDir = "cd " + aDir + "/";
   // System(aCdDir);
   if (!EAMIsInit(&aSeq) ) aSeq = aDir;

   cElemAppliSetFile anEASF(aDir+"/.*jpg");

   const std::vector<std::string> * aVS = anEASF.SetIm();
   int aNbIm = aVS->size();
   for (int aK=0 ; aK<aNbIm ; aK++)
   {
        const std::string & aName = (*aVS)[aK];
        ELISE_fp::MvFile(aDir+"/"+aName,aDir+"/"+aSeq+"_Calib" +ToString(aK) + ".jpg");
        std::cout << "NAME = " << aName << "\n";
   }

   std::string aStrMMD= "MicMac-LocalChantierDescripteur.xml";

   ELISE_fp::CpFile(aStrMMD,aDir+"/"+aStrMMD);


   std::string aComTiep = MM3dBinFile_quotes("Tapioca") + " All  " + aDir + "/.*jpg " + ToString(aSz);
   System(aComTiep);

   std::string aComOri =  MM3dBinFile_quotes("Tapas ") + " FraserBasic " +  aDir + "/.*jpg " + " Out=" + OutCal
                          + " RankInitPP=0 RankInitF=1 RefineAll=0";
   System(aComOri);


   return EXIT_SUCCESS;
}
cAppliReechHomogr::cAppliReechHomogr(int argc,char ** argv)  :
    mPostMasq ("Masq"),
    mH1To2    (cElHomographie::Id()),
    mH2To1    (cElHomographie::Id())
{
    ElInitArgMain
    (
          argc,argv,
          LArgMain()  << EAMC(mFullNameI1,"Name of \"Master\" Image", eSAM_IsExistFile)
                      << EAMC(mFullNameI2,"Name of \"Slave\" Image", eSAM_IsExistFile)
                      << EAMC(mNameI2Redr,"Name of resulting registered Image", eSAM_IsExistFile),
          LArgMain()  << EAM (mPostMasq,"PostMasq",true,"Name of Masq , Def = \"Masq\"")
    );

     mNameI1 = NameWithoutDir(mFullNameI1);
     mNameI2 = NameWithoutDir(mFullNameI2);
   
     mEASF.Init(mFullNameI1);

     mKeyHom = "NKS-Assoc-CplIm2Hom@@dat";

     std::string aNameH = mEASF.mDir + mEASF.mICNM->Assoc1To2(mKeyHom,mNameI1,mNameI2,true);
     ElPackHomologue aPack = ElPackHomologue::FromFile(aNameH);

     double anEcart,aQuality;
     bool Ok;
     mH1To2 = cElHomographie::RobustInit(anEcart,&aQuality,aPack,Ok,50,80.0,2000);
     mH2To1 = mH1To2.Inverse();
     std::cout << "Ecart " << anEcart << " ; Quality " << aQuality    << " \n";

     cMetaDataPhoto aMTD1 = cMetaDataPhoto::CreateExiv2(mFullNameI1);
     cMetaDataPhoto aMTD2 = cMetaDataPhoto::CreateExiv2(mFullNameI2);


     ReechFichier
     (
          false,
          mFullNameI2,
          Box2dr(Pt2dr(0,0),Pt2dr(aMTD2.TifSzIm())),
          this,
          Box2dr(Pt2dr(0,0),Pt2dr(aMTD1.TifSzIm())),
          10.0,
          mNameI2Redr,
          mPostMasq,
          5
     );

}
Beispiel #18
0
int CASA_main(int argc,char ** argv)
{
    std::string aNameN1;
    std::string aNameN2;
    std::string aNameN3;
    std::string aNameN4;
    std::string Out="TheCyl.xml";
    std::vector<std::string> aVPts;

    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aNameN1,"Name of Cloud", eSAM_IsExistFile),
        LArgMain()  << EAM(Out,"Out",true,"Name of result (Def=TheCyl.xml)")
                    <<  EAM(aNameN2,"N2",true,"Name of optional second cloud", eSAM_IsExistFile)
                    <<  EAM(aNameN3,"N3",true,"Name of optional third cloud", eSAM_IsExistFile)
                    <<  EAM(aNameN4,"N4",true,"Name of optional fourth cloud", eSAM_IsExistFile)
                    <<  EAM(aVPts,"PtsOri",true,"[Pts2D.xml,Ori], points and Orientation (used for seizing) to specify surface")
     );

     if (MMVisualMode) return EXIT_SUCCESS;

     std::string aCom =   MM3dBinFile(" TestLib CASALL ")
                       + XML_MM_File("ParamCasa.xml")
                       + " +Out=" + Out
                       + " +N1=" + aNameN1;

     if (EAMIsInit(&aNameN2))
        aCom = aCom + " +UseN2=true +N2=" + aNameN2;

     if (EAMIsInit(&aNameN3))
        aCom = aCom + " +UseN3=true +N3=" + aNameN3;

     if (EAMIsInit(&aNameN4))
        aCom = aCom + " +UseN4=true +N4=" + aNameN4;

     if (EAMIsInit(&aVPts))
     {
         ELISE_ASSERT(aVPts.size()==2,"Require 2 args for PtsOri");
         aCom = aCom + " +Pts=" + aVPts[0] + " +PtsOri=" + aVPts[1] + " +UsePts=true" ;
     }

     System(aCom);

     Casa_Banniere();

     return 1;
}
int  Arsenic_main(int argc,char ** argv)
{

    std::string aFullPattern,aDirOut="Egal/",InVig="";
    //bool InTxt=false;
    int ResolModel=16;
    double TPA=16,aThresh=1.4;
    int nbIte=5;
      //Reading the arguments
        ElInitArgMain
        (
            argc,argv,
            LArgMain()  << EAMC(aFullPattern,"Images Pattern", eSAM_IsPatFile),
            LArgMain()  << EAM(aDirOut,"Out",true,"Output folder (end with /) and/or prefix (end with another char)")
                        << EAM(InVig,"InVig",true,"Input vignette folder (for example : Vignette/ )", eSAM_IsDir)
                        << EAM(ResolModel,"ResolModel",true,"Resol of input model (Def=16)")
                        << EAM(TPA,"TPA",true,"Tie Point Accuracy (Higher is better, lower gives more points Def=16)")
                        << EAM(nbIte,"NbIte",true,"Number of iteration of the process (default=5)")
                        << EAM(aThresh,"ThreshDisp",true,"Disparity threshold between the tie points (Def=1.4 for 40%)")
        );

        if (!MMVisualMode)
        {
            std::string aDir,aPatIm;
            SplitDirAndFile(aDir,aPatIm,aFullPattern);

            cInterfChantierNameManipulateur * aICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
            const std::vector<std::string> * aSetIm = aICNM->Get(aPatIm);

            std::vector<std::string> aVectIm=*aSetIm;
            int nbIm=aVectIm.size();

            ELISE_ASSERT(nbIm>1,"Less than two images found with this pattern");

            //Computing homologous points
            cout<<"Computing homologous points"<<endl;
            cl_MatPtsHom aMatPtsHomol=ReadPtsHom3D(aDir, aPatIm, InVig, ResolModel, TPA);

            //Computing and applying the equalization surface
            cout<<"Computing and applying the equalization surface"<<endl;
            Egal_field_correct_ite(aDir, & aVectIm, aMatPtsHomol, aDirOut, InVig, ResolModel, nbIm, nbIte, aThresh);

            Arsenic_Banniere();
        }

        return 0;
}
Beispiel #20
0
int cod_main(int argc,char ** argv)
{
    string Name;
    INT decoder = 0;

    ElInitArgMain
    (
        argc,argv,
        LArgMain() 	<< EAM(Name) ,
        LArgMain() 	 << EAM(decoder,"dc",true)
    );	

    FileCode FC(!decoder);
    // code_file(Name.c_str());
    ElParseDir(strdup(Name.c_str()),FC);
    return 0;
}
int AllReechHom_main(int argc,char ** argv)
{
    std::string aFullName1,aPat,aPref,aPostMasq = "Masq";
    ElInitArgMain
    (
          argc,argv,
          LArgMain()  << EAMC(aFullName1,"Name of \"Master\" Image", eSAM_IsExistFile)
                      << EAMC(aPat,"Name of all \"Slaves\" Image", eSAM_IsExistFile)
                      << EAMC(aPref,"Name of Prefix for registered Images", eSAM_IsExistFile),
          LArgMain()   <<  EAM(aPostMasq,"PostMasq",true,"Name of Masq , Def = \"Masq\"")
    );

    cElemAppliSetFile anEASF(aPat);
    const cInterfChantierNameManipulateur::tSet *  aSet = anEASF.SetIm();

    std::string aName1 = NameWithoutDir(aFullName1);

    std::list<std::string>  aLCom;

    for (int aK=0 ; aK<int(aSet->size()) ; aK++)
    {
         std::string aName2 = (*aSet)[aK];
         if (aName1 != aName2)
         {
             std::string aNameRes = anEASF.mDir +  aPref +aName2 + ".tif";
             if (! ELISE_fp::exist_file(aNameRes))
             {
                 // std::cout << "RES = " << aNameRes << "\n";
                 std::string aCom =  MM3dBinFile_quotes("TestLib")
                                     + " OneReechHom " 
                                     +   aFullName1
                                     +  " " + anEASF.mDir + aName2 
                                     +  " " +  aNameRes
                                     +  " PostMasq=" + aPostMasq;

                 aLCom.push_back(aCom);
                 // std::cout << "COM= " << aCom << "\n";
             }
         }
    }
    cEl_GPAO::DoComInParal(aLCom);

   
     return EXIT_SUCCESS;
}
Beispiel #22
0
int XeresTest_Main(int argc,char** argv)
{
   MMD_InitArgcArgv(argc,argv);

   std::string aSeq;

   ElInitArgMain
   (
         argc,argv,
         LArgMain()  << EAMC(aSeq, "Sequence"),
         LArgMain()  // << EAM(mCalib,"OriCalib",true,"Calibration folder if any")
   );

   cAppliXeres anAppli("./",aSeq);
   anAppli.TestInteractNeigh();

   return EXIT_SUCCESS;
}
int  LucasChCloud_main(int argc,char ** argv)
{
  //=====================  PARAMETRES EN DUR ==============


    std::string aNameNuage,aNameOut;
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aNameNuage,"Name input "),
        LArgMain()  << EAM(aNameOut,"Out",true)
    );



    if (! EAMIsInit(&aNameOut))
       aNameOut = DirOfFile(aNameNuage) + "TestScale_" + NameWithoutDir(aNameNuage);


  cXML_ParamNuage3DMaille aXML =   StdGetObjFromFile<cXML_ParamNuage3DMaille>
                                         (
                                               aNameNuage,
                                               StdGetFileXMLSpec("SuperposImage.xml"),
                                               "XML_ParamNuage3DMaille",
                                               "XML_ParamNuage3DMaille"
                                         );


   double aScale = 2;
   cRepereCartesien aRep;

   aRep.Ori() = Pt3dr(0,0,0);
   aRep.Ox() = Pt3dr(aScale,0,0);
   aRep.Oy() = Pt3dr(0,aScale,0);
   aRep.Oz() = Pt3dr(0,0,aScale);

    aXML.RepereGlob().SetVal(aRep);
  
    

   MakeFileXML(aXML,aNameOut);

   return 0;
}
Beispiel #24
0
int TestSet_main(int argc,char ** argv)
{
   MMD_InitArgcArgv(argc,argv,2);

    std::string  aDir,aPat,aFullDir;
    int  aNbMax=10;

    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aFullDir,"Full Directory (Dir+Pattern)", eSAM_IsPatFile),
        LArgMain()  << EAM(aNbMax,"Nb",true,"Nb Max printed (def=10)")
    );

    if (MMVisualMode) return EXIT_SUCCESS;

#if (ELISE_windows)
    replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
#endif
    SplitDirAndFile(aDir,aPat,aFullDir);
    cInterfChantierNameManipulateur * aICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
    const cInterfChantierNameManipulateur::tSet * mSetIm = aICNM->Get(aPat);


    int aNb = ElMin(aNbMax,int(mSetIm->size()));

    for (int aK=0 ; aK< aNb ; aK++)
    {
         std::string aName = (*mSetIm)[aK];
         printf("%3d ",aK);
         std::cout << aName ;
         std::cout  << "\n";
    }

    if (1)
    {
         // std::list<std::string>  aL = RegexListFileMatch(aDir,aPat,1,false);
          std::cout << "NB  BY RFLM " << mSetIm->size() << "\n";
    }


    return EXIT_SUCCESS;
}
Beispiel #25
0
int TestNameCalib_main(int argc,char ** argv)
{
    std::string aFullNameIm,aNameCalib="TestNameCalib";
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(aFullNameIm, "Name of images", eSAM_IsPatFile),
        LArgMain()  << EAM(aNameCalib,"Nb",true,"Name of caib (def=TestNameCalib)")
    );

    std::string aDir,aNameIm;

    SplitDirAndFile(aDir,aNameIm,aFullNameIm);
    cInterfChantierNameManipulateur * aICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);

    std::cout << aICNM->StdNameCalib(aNameCalib,aNameIm) << "\n";

    return EXIT_SUCCESS;
}
int PastDevlop_main(int argc,char ** argv)
{
    MMD_InitArgcArgv(argc,argv);

    std::string aFullName;

    int aSz1 = -1;
    int aSz2 = -1;
    bool aCoul8B = false;


    ElInitArgMain
    (
    argc,argv,
    LArgMain()  << EAMC(aFullName, "Full Directory (Dir+Pattern)", eSAM_IsPatFile),
    LArgMain()  << EAM(aSz1,"Sz1",true)
                << EAM(aSz2,"Sz2",true)
                << EAM(aCoul8B,"Coul8B",true)
    );

    if (!MMVisualMode)
    {
        cInterfChantierNameManipulateur::BasicAlloc(DirOfFile(aFullName));

        Tiff_Im::StdConvGen(aFullName,1,true,true);
        Tiff_Im::StdConvGen(aFullName,1,false,true);

        if (aCoul8B)
        {
           Tiff_Im::StdConvGen(aFullName,3,false,true);
        }

        cTplValGesInit<std::string> aTName;
        cInterfChantierNameManipulateur::StdAlloc(argc,argv,DirOfFile(aFullName),aTName);

        DoSimplePastisSsResol(aFullName,-1);
        if (aSz1 >0)
           DoSimplePastisSsResol(aFullName,aSz1);
        if (aSz2 >0)
           DoSimplePastisSsResol(aFullName,aSz2);
    }
    return EXIT_SUCCESS;
}
Beispiel #27
0
cAppliStephane::cAppliStephane(int argc,char ** argv)
{
    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(mN1,"Name of camera 1")
                    << EAMC(mN2,"Name of camera 2")
                    << EAMC(mN3,"Name of camera 3"),
        LArgMain()  << EAM(mCalib,"OriCalib",true,"Optionnal calibration")
   );

   mNM = cVirtInterf_NewO_NameManager::StdAlloc(DirOfFile(mN1),mCalib);


   mNM->LoadTriplet(mN1,mN2,mN3,&mVP1,&mVP2,&mVP3);

   std::cout << " SIZE " << mVP1.size() << " " << mVP2.size() << " " << mVP3.size() << "\n";
   std::cout << " SIZE " << mVP1[0] << " " << mVP2[0] << " " << mVP3[0] << "\n";

}
int PreGenerateDuTriplet(int argc,char ** argv,const std::string & aComIm)
{
   MMD_InitArgcArgv(argc,argv);

   std::string aFullName,anOriCalib;
   bool aQuick;
   ElInitArgMain
   (
        argc,argv,
        LArgMain() << EAMC(aFullName,"Name of Image"),
        LArgMain() << EAM(anOriCalib,"OriCalib",true,"Calibration directory ")
                   << EAM(aQuick,"Quick",true,"Quick version")
   );

   cElemAppliSetFile anEASF(aFullName);
   if (!EAMIsInit(&anOriCalib))
   {
      MakeXmlXifInfo(aFullName,anEASF.mICNM);
   }

   cNewO_NameManager aNM(aQuick,anEASF.mDir,anOriCalib,"dat");
   aNM.Dir3P(true);
   const cInterfChantierNameManipulateur::tSet * aSetIm = anEASF.SetIm();

   std::list<std::string> aLCom;
   for (int aKIm=0 ; aKIm<int(aSetIm->size()) ; aKIm++)
   {
        std::string aCom =   MM3dBinFile_quotes( "TestLib ") + aComIm + " "  + anEASF.mDir+(*aSetIm)[aKIm] ;

        if (EAMIsInit(&anOriCalib))  aCom = aCom + " OriCalib=" + anOriCalib;
        aCom += " Quick=" +ToString(aQuick);
        aLCom.push_back(aCom);

        //std::cout << aCom << "\n";

   }

   cEl_GPAO::DoComInParal(aLCom);

    return EXIT_SUCCESS;
}
Beispiel #29
0
int XeresHomMatch_main(int argc,char** argv)
{
   MMD_InitArgcArgv(argc,argv);

   std::string aDir="./";
   std::string aSeq;
   std::string anOri;

   ElInitArgMain
   (
         argc,argv,
         LArgMain()  << EAMC(aSeq, "Sequence")
                     << EAMC(anOri,"Orientation"),
         LArgMain()  << EAM(aDir,"Dir",true,"Folder of data, Def=./")
   );

   cAppliXeres  anAppli(aDir,aSeq);
   StdCorrecNameOrient(anOri,aDir);
   anAppli.CalculHomMatch(anOri);

   return EXIT_SUCCESS;
}
int Drunk_main(int argc,char ** argv)
{

    //Testing the existence of argument (if not, print help file)
    if(!MMVisualMode && argc==1)
    {
        argv[1]=(char*)"";//Compulsory to call MMD_InitArgcArgv
        MMD_InitArgcArgv(argc,argv);
        string cmdhelp;
        cmdhelp=MMDir()+"bin/Drunk -help";
        system_call(cmdhelp.c_str());
    }
    else
    {
        MMD_InitArgcArgv(argc,argv);

        string aFullPattern,aOri;
        string DirOut="DRUNK/";
        bool Talk=true;

        //Reading the arguments
        ElInitArgMain
        (
            argc,argv,
            LArgMain()  << EAMC(aFullPattern,"Images Pattern", eSAM_IsPatFile)
                        << EAMC(aOri,"Orientation name", eSAM_IsExistDirOri),
            LArgMain()  << EAM(DirOut,"Out",true,"Output folder (end with /) and/or prefix (end with another char)")
                        << EAM(Talk,"Talk",true,"Turn on-off commentaries")
                    );

        //Processing the files
		string aPattern, aDir;
		SplitDirAndFile(aDir, aPattern, aFullPattern);
		StdCorrecNameOrient(aOri, aDir);
        Drunk(aPattern,aOri,DirOut,Talk);
    }

    return EXIT_SUCCESS;
}