Esempio n. 1
0
cAppli_C3DC::cAppli_C3DC(int argc,char ** argv,bool DoMerge) :
    cAppliWithSetImage  (argc-2,argv+2,TheFlagDev16BGray|TheFlagAcceptProblem),
    mTuning             (MPD_MM()),
    mPurge              (true),
    mPlyCoul            (true),
    mMergeOut           ("C3DC.ply"),
    mSzNorm             (3),
    mDS                 (1.0),
    mZoomF              (1),
    mDoMerge            (DoMerge),
    mMMIN               (0),
    mUseGpu	       (false),
    mArgSupEpip         (""),
    mDebugMMByP         (false)
{


#if(ELISE_QT_VERSION >= 4)

    if (MMVisualMode)
    {
        QApplication app(argc, argv);

        LArgMain LAM;
        LAM << EAMC(mStrType,"Mode",eSAM_None,ListOfVal(eNbTypeMMByP));

        std::vector <cMMSpecArg> aVA = LAM.ExportMMSpec();

        cMMSpecArg aArg = aVA[0];

        list<string> liste_valeur_enum = listPossibleValues(aArg);

        QStringList items;
        list<string>::iterator it=liste_valeur_enum.begin();
        for (; it != liste_valeur_enum.end(); ++it)
            items << QString((*it).c_str());

        setStyleSheet(app);

        bool ok = false;
        int  defaultItem = 0;

        if(argc > 1)
            defaultItem = items.indexOf(QString(argv[1]));

        QInputDialog myDialog;
        QString item = myDialog.getItem(NULL, app.applicationName(),
                                        QString (aArg.Comment().c_str()), items, defaultItem, false, &ok);

        if (ok && !item.isEmpty())
            mStrType = item.toStdString();
        else
            return;

        ReadType(mStrType);
    }
    else
    {
        ELISE_ASSERT(argc >= 2,"Not enough arg");
        ReadType(argv[1]);
    }
#else
    ELISE_ASSERT(argc >= 2,"Not enough arg");
    ReadType(argv[1]);
#endif

    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(mStrType,"Type in enumerated values", eSAM_None,ListOfVal(eNbTypeMMByP))
        << EAMC(mEASF.mFullName,"Full Name (Dir+Pattern)", eSAM_IsPatFile)
        << EAMC(mOriFull,"Orientation", eSAM_IsExistDirOri),
        LArgMain()
        << EAM(mMasq3D,"Masq3D",true,"3D masq for point selection",eSAM_IsExistFileRP)
        << EAM(mMergeOut,"Out",true,"final result (Def=C3DC.ply)")
        << EAM(mSzNorm,"SzNorm",true,"Sz of param for normal evaluation (<=0 if none, Def=2 means 5x5) ")
        << EAM(mPlyCoul,"PlyCoul",true,"Colour in ply ? (Def = true)")
        << EAM(mTuning,"Tuning",true,"Will disappear one day ...",eSAM_InternalUse)
        << EAM(mPurge,"Purge",true,"Purge result, (Def=true)")
        << EAM(mDS,"DownScale",true,"DownScale of Final result, Def depends on mode")
        << EAM(mZoomF,"ZoomF",true,"Zoom final, Def depends on mode",eSAM_IsPowerOf2)
        << EAM(mUseGpu,"UseGpu",false,"Use cuda (Def=false)")
        << EAM(mDefCor,"DefCor",true,"Def correlation, context depend")
        << EAM(mZReg,"ZReg",true,"Regularisation, context depend")
        << EAM(mFilePair,"FilePair",true,"Explicit pairs of images (as in Tapioca)", eSAM_IsExistFileRP)
        << EAM(mDebugMMByP,"DebugMMByP",true,"Debug MMByPair ...")
    );

    if (MMVisualMode) return;

    if (!EAMIsInit(&mDS))
    {
        // if (mType==eQuickMac) mDS = 2.0;
    }
    if (!EAMIsInit(&mZoomF))
    {
        if (mType==eBigMac)   mZoomF = 2;
        if (mType==eMicMac)   mZoomF = 4;
        if (mType==eQuickMac) mZoomF = 8;
        if (mType==eStatue)   mZoomF = 2;
        if (mType==eForest)   mZoomF = 4;
    }

    if (EAMIsInit(&mDefCor)) mArgSupEpip +=  " DefCor=" + ToString(mDefCor);
    if (EAMIsInit(&mZReg)) mArgSupEpip +=  " ZReg=" + ToString(mZReg);

    if (! EAMIsInit(&mMergeOut)) mMergeOut = "C3DC_"+ mStrType + ".ply";

    mStrImOri0  =  BLANK + QUOTE(mEASF.mFullName) +  BLANK + Ori() + BLANK;
    mStrImOriApSec = BLANK +  DirAndPatFileMMByP() +  BLANK + Ori() + BLANK;
    mArgMasq3D = "";
    if (EAMIsInit(&mMasq3D))
        mArgMasq3D = std::string(" Masq3D=" + mMasq3D + BLANK) ;


    //=====================================

    mBaseComMMByP =    MM3dBinFile("MMByP ")
                       +  BLANK + mStrType
                       +  mStrImOri0
                       +  mArgMasq3D
                       +  " UseGpu=" + ToString(mUseGpu);
    if (mDebugMMByP)
        mBaseComMMByP = mBaseComMMByP + " DebugMMByP=true";

    if (EAMIsInit(&mFilePair))
        mBaseComMMByP  += " FilePair=" + mFilePair;


    //=====================================
    mBaseComEnv =      MM3dBinFile("TestLib MMEnvlop ")
                       +  mStrImOriApSec
                       +  std::string(" 16 ")  + ToString(mZoomF) + " "
                       +  mArgMasq3D
                       +  std::string(" AutoPurge=") + ToString(mPurge)
                       +  " Out=" + mStrType
                       ;

    /*
    if (mTuning)
    {
       mBaseComEnv = mBaseComEnv + " DoPlyDS=true";
    }
    */

    //=====================================

    mComMerge =      MM3dBinFile("TestLib  MergeCloud ")
                     +  mStrImOri0 + " ModeMerge=" + mStrType
                     +  " DownScale=" +ToString(mDS)
                     ;

    if (mSzNorm>=0)
    {
        mComMerge = mComMerge + " SzNorm=" + ToString(1+2*mSzNorm);
    }

    mComMerge +=  " PlyCoul=" + ToString(mPlyCoul);

    mMMIN = cMMByImNM::ForGlobMerge(Dir(),mDS,mStrType);

    //=====================================

    std::string aDirFusMM = mMMIN->FullDir();

    mComCatPly =  MM3dBinFile("MergePly ") + QUOTE( aDirFusMM + ".*Merge.*ply") + " Out="  + mMergeOut;

    mStrZ0ZF = " Zoom0=" + ToString(mZoomF) + " ZoomF=" + ToString(mZoomF);
    mMMIN->SetOriOfEtat(mOri);
}