bool isFirstArgMalt(string val) { list <string> strList = ListOfVal(eTMalt_NbVals,"eTMalt_"); if (std::find(strList.begin(), strList.end(), val) != strList.end()) return true; return false; }
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; }
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 ; }
int SEL_main(int argc,char ** argv) { MMD_InitArgcArgv(argc,argv); Pt2di aSzW(1000,900); /* if (! ELISE_fp::exist_file(MMDir() + "bin/MICMACSaisieLiaisons")) VoidSystem("make -f MakeMICMAC bin/MICMACSaisieLiaisons"); */ std::string aDir; std::string aN1; std::string aN2; std::string aKeyH; int aRedr=0; std::string aFilter=""; bool aRedrL1 = false; bool ModeEpip = false; std::string aKeyCompl="Cple2HomAp"; std::string SH=""; ElInitArgMain ( argc,argv, LArgMain() << EAMC(aDir,"Directory", eSAM_IsDir) << EAMC(aN1,"First image name", eSAM_IsExistFile) << EAMC(aN2,"Second image name", eSAM_IsExistFile) , LArgMain() << EAM(aRedr,"R",true) << EAM(aRedrL1,"RL1",true,"Estimate Homography using L1 mode") << EAM(aFilter,"F",true) << EAM(aKeyH,"KH",true,"In P PB PBR M S NB NT MMD",eSAM_None,ListOfVal(eTS_NbVals,"eTS_")) << EAM(aKeyCompl,"KCpl",true) << EAM(aSzW,"SzW",true) << EAM(ModeEpip,"ModeEpip",true,"If mode epip, the y displacement are forced to 0") << EAM(SH,"SH",true,"Homologue extenion for NB/NT mode") ); if (!MMVisualMode) { std::string aCom = MM3dBinFile("MICMACSaisieLiaisons") // + MMDir()+std::string("applis/XML-Pattron/Pattron-MicMacLiaison.xml ") + MMDir()+std::string("include/XML_MicMac/Pattron-MicMacLiaison.xml ") + " WorkDir=" + aDir + " %Im1=" + aN1 + " %Im2=" + aN2 + " %SL_XSzW=" + ToString(aSzW.x) + " %SL_YSzW=" + ToString(aSzW.y) + " %SL_Epip=" + ToString(ModeEpip) ; if (aRedr) aCom = aCom + " SL_NewRedrCur=true"; if (aRedrL1) aCom = aCom + " SL_L2Estim=false"; if (aFilter!="") aCom = aCom /* + " SL_TJS_FILTER=true" */ + " SL_FILTER=" +aFilter; if (aKeyH!="") { if (aKeyH=="P") { aKeyCompl = "PastisHom"; } else if (aKeyH=="PB") { aKeyCompl = "Key-Assoc-CpleIm2HomolPastisBin"; } else if (aKeyH=="PBR") { aKeyCompl = "Key-Assoc-SsRes-CpleIm2HomolPastisBin"; } else if (aKeyH=="M") { aKeyCompl = "MarcHom"; } else if (aKeyH=="S") { // aKeyCompl = "Key-Assoc-StdHom"; aKeyCompl = "NKS-Assoc-CplIm2Hom@-Man@xml"; } else if (aKeyH=="NB") { aKeyCompl = "NKS-Assoc-CplIm2Hom@"+SH+"@dat"; } else if (aKeyH=="NT") { aKeyCompl = "NKS-Assoc-CplIm2Hom@"+SH+"@txt"; } else if (aKeyH=="MMD") { aKeyCompl = "NKS-Assoc-CplIm2Hom@-DenseM@dat"; } else { std::cout << "For Key=[" << aKeyH << "]\n"; ELISE_ASSERT(false,"Do Not know key"); } } aCom = aCom + " FCND_CalcHomFromI1I2=" + aKeyCompl; std::cout << aCom << "\n"; Sys(aCom); Banniere_SEL(); return 0; } else return EXIT_SUCCESS; }
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); }
int ConvertIm_main(int argc,char ** argv) { MMD_InitArgcArgv(argc,argv); Tiff_Im::SetDefTileFile(1000000); std::string aNameIn ; INT aReducX=0; INT aReducY=0; INT aReducXY=0; INT aVisu=0; GenIm::type_el aTypeOut ; std::string aNameTypeOut =""; Tiff_Im::PH_INTER_TYPE aPhInterpOut ; std::string aNamePITOut =""; std::string PITOut[] = {"RGB","BW"}; std::list<std::string> lOut(PITOut, PITOut + sizeof(PITOut) / sizeof(std::string) ); std::string aNameOut; std::string anExt; Pt2di aP0(0,0); Pt2di aSzOut ; Pt2di aSzTF(-1,-1); REAL aDyn=1.0; Pt2di aSzTileInterne(-1,-1); int aKCh = -1; std::vector<int> aVPermut; int aNoTile = 0; std::string aF2 =""; ElInitArgMain ( argc,argv, LArgMain() << EAMC(aNameIn, "Image", eSAM_IsExistFile), LArgMain() << EAM(aNameOut,"Out",true) << EAM(anExt,"Ext",true) << EAM(aSzOut,"SzOut",true, "Size out", eSAM_NoInit) << EAM(aP0,"P0",true) << EAM(aNameTypeOut,"Type",true, "TypeMNT", eSAM_None, ListOfVal(GenIm::bits1_msbf, "")) << EAM(aNamePITOut,"Col",true, "Col", eSAM_None,lOut) << EAM(aReducXY,"ReducXY",true) << EAM(aReducX,"ReducX",true) << EAM(aReducY,"ReducY",true) << EAM(aVisu,"Visu",true) << EAM(aSzTF,"SzTifTile",true) << EAM(aSzTileInterne,"SzTileInterne",true) << EAM(aDyn,"Dyn",true) << EAM(aKCh,"KCh",true) << EAM(aNoTile,"NoTile",true) << EAM(aVPermut,"Permut",true, "Permut", eSAM_NoInit) << EAM(aF2,"F2",true) ); if (!MMVisualMode) { // Tiff_Im aTifIn = Tiff_Im::BasicConvStd(aNameIn); Tiff_Im aTifIn = Tiff_Im::UnivConvStd(aNameIn); INT aNbChIn = aTifIn.nb_chan(); if (! EAMIsInit(&aTypeOut)) aTypeOut =aTifIn.type_el(); if (! EAMIsInit(&aPhInterpOut)) aPhInterpOut = aTifIn.phot_interp(); if (! EAMIsInit(&aSzOut)) aSzOut = aTifIn.sz(); if (aReducXY) { aReducX = 1; aReducY = 1; } if (aNameOut=="") { if (anExt=="") { if (aReducX && aReducY) anExt = "_RXY"; else if (aReducX) anExt = "_RX"; else if (aReducY) anExt = "_RY"; else anExt= "_Out"; } if (IsPostfixed(aNameIn)) aNameOut = StdPrefix(aNameIn) + anExt +"." + StdPostfix(aNameIn); else aNameOut = aNameIn + anExt + "tif"; } Pt2di aCoefReduc(aReducX != 0 ? 2 : 1, aReducY != 0 ? 2 : 1); aSzOut = aSzOut.dcbyc(aCoefReduc); if (aNameTypeOut != "") aTypeOut = type_im(aNameTypeOut); if (aKCh != -1) aNamePITOut="BW"; if ( aVPermut.size() !=0) { if ( aVPermut.size() ==1) aPhInterpOut = Tiff_Im::BlackIsZero; else if ( aVPermut.size() ==3) aPhInterpOut = Tiff_Im::RGB; else { ELISE_ASSERT(aNamePITOut=="","Nb Canaux incoherents"); } } else { if (aNamePITOut=="RGB") aPhInterpOut = Tiff_Im::RGB; else if (aNamePITOut=="BW") aPhInterpOut = Tiff_Im::BlackIsZero; else { ELISE_ASSERT(aNamePITOut=="","Mode Couleur Inconnu"); } } Tiff_Im::COMPR_TYPE aComprOut = Tiff_Im::No_Compr; L_Arg_Opt_Tiff aLArg = Tiff_Im::Empty_ARG; if (! aNoTile) { if (aSzTileInterne != Pt2di(-1,-1)) aLArg = aLArg + Arg_Tiff(Tiff_Im::ATiles(aSzTileInterne)); if (aSzTF != Pt2di(-1,-1)) aLArg = aLArg + Arg_Tiff(Tiff_Im::AFileTiling(aSzTF)); } else { aLArg = aLArg + Arg_Tiff(Tiff_Im::ANoStrip()); aLArg = aLArg + Arg_Tiff(Tiff_Im::AFileTiling(Pt2di(-1,-1))); } Tiff_Im aTifOut ( aNameOut.c_str(), aSzOut, aTypeOut, aComprOut, aPhInterpOut, aLArg ); INT aNbChOut = aTifOut.nb_chan(); Pt2di aSzROut = aSzOut; Output anOut = aTifOut.out(); Fonc_Num aFin = aTifIn.in_proj(); if (aF2!="") { Tiff_Im aT2 = Tiff_Im::BasicConvStd(DirOfFile(aNameIn)+aF2); aFin = Virgule(aFin,aT2.in(0)); } if (aVPermut.size() != 0) aFin = aFin.permut(aVPermut); if (type_im_integral( aTypeOut)) { } else { aFin = Rconv(aFin); } aFin = reduc_binaire_gen(aFin, aReducX != 0, aReducY != 0, 16, true, 0); anOut = Filtre_Out_RedBin_Gen(anOut, aReducX != 0, aReducY != 0); aSzROut = aSzOut.mcbyc(aCoefReduc); aFin = trans(aFin,aP0); if (aKCh!=-1) aFin = aFin.kth_proj(aKCh); else { if ((aNbChOut==1) && (aNbChIn==3)) aFin = (aFin.v0() + aFin.v1() + aFin.v2()) / 3.0; if ((aNbChOut==3) && (aNbChIn==1)) aFin = Virgule(aFin,aFin,aFin); } if (aVisu) anOut = anOut | Video_Win::WiewAv(aSzROut); if (aDyn != 1.0) aFin = aFin * aDyn; if (type_im_integral(aTypeOut) && (aTypeOut!=GenIm::int4)) { int aVMin,aVMax; min_max_type_num(aTypeOut,aVMin,aVMax); aFin = Max(aVMin,Min(aVMax-1,aFin)); } ELISE_COPY(rectangle(Pt2di(0,0),aSzROut),aFin,anOut); return EXIT_SUCCESS; } else return EXIT_SUCCESS; }
int GrShade_main(int argc,char ** argv) { std::string aNameIn; std::string aNameOut; std::string aNameCol=""; Pt2di aP0Glob(0,0),aSzGlob(0,0); INT aNbDir = 20; REAL aFZ = 1.0; REAL aPdsAnis = 0.95; INT aBrd = -1; std::string aTMNt = "real4"; std::string aTShade = "real4"; INT aDequant =0; INT aVisu = 0; REAL aHypsoDyn = -1.0; REAL aHypsoSat = 0.5; Pt2di aSzMaxDalles (3000,3000); INT aSzRecDalles = 300; std::string aModeOmbre="CielVu"; std::string modeOmbre[] = {aModeOmbre,"IgnE","Local","Med","Mixte"}; std::list<std::string> lModeOmbre(modeOmbre, modeOmbre + sizeof(modeOmbre) / sizeof(std::string) ); std::string aFileMasq=""; double aDericheFact=2.0; int aNbIterF = 4; double aFactExp = 0.95; double aDyn = 1.0; int aNbMed = 100; int aNbIterMed = 1; Tiff_Im::SetDefTileFile(1<<15); std::vector<double> aVPdsFiltre; std::string aModeColor = "IntensShade"; std::string modeColor[] = {aModeColor,"BackRGB","GrayBackRGB"}; std::list<std::string> lModeColor(modeColor, modeColor + sizeof(modeColor) / sizeof(std::string) ); double aTetaH = 25.0; double anAzimut = 0.0; double aDynMed = 1.0; ElInitArgMain ( argc,argv, LArgMain() << EAMC(aNameIn, "File name", eSAM_IsExistFile) , LArgMain() << EAM(aNameOut,"Out",true) << EAM(aNameCol,"FileCol",true, "Color file", eSAM_IsExistFile) << EAM(aVisu,"Visu",true) << EAM(aP0Glob,"P0",true) << EAM(aSzGlob,"Sz",true) << EAM(aFZ,"FZ",true) << EAM(aDynMed,"DynMed",true) << EAM(aPdsAnis,"Anisotropie",true) << EAM(aNbDir,"NbDir",true) << EAM(aBrd,"Brd",true) << EAM(aTMNt,"TypeMnt",true, "Type", eSAM_None, ListOfVal(GenIm::bits1_msbf, "")) << EAM(aTShade,"TypeShade",true, "Type", eSAM_None, ListOfVal(GenIm::bits1_msbf, "")) << EAM(aDequant,"Dequant",true) << EAM(aHypsoDyn,"HypsoDyn",true) << EAM(aHypsoSat,"HypsoSat",true) << EAM(aSzMaxDalles,"SzMaxDalles",true) << EAM(aSzRecDalles,"SzRecDalles",true) << EAM(aModeOmbre,"ModeOmbre",true,"in {CielVu,IgnE,Local,Med,Mixte}",eSAM_None,lModeOmbre) << EAM(aFileMasq,"Mask",true, "Mask file", eSAM_IsExistFile) << EAM(aDericheFact,"DericheFact",true) << EAM(aNbIterF,"NbIterF",true) << EAM(aFactExp,"FactExp",true) << EAM(aDyn,"Dyn",true) << EAM(aVPdsFiltre,"PdsF",true,"[CielVu,Local,Grad,Med]", eSAM_NoInit) << EAM(aModeColor,"ModeColor",true,"Color mode", eSAM_None, lModeColor) << EAM(aNbMed,"NbMed",true) << EAM(aNbIterMed,"NbIterMed",true) << EAM(aTetaH,"TetaH",true) << EAM(anAzimut,"Azimut",true) ); if (!MMVisualMode) { double aPdsDef = aVPdsFiltre.size() ? 0 : 1; for (int aK=aVPdsFiltre.size() ; aK<4 ; aK++) aVPdsFiltre.push_back(aPdsDef); double aSPdsF = 0; for (int aK=0 ; aK<4 ; aK++) aSPdsF += aVPdsFiltre[aK]; for (int aK=0 ; aK<4 ; aK++) aVPdsFiltre[aK] /= aSPdsF; std::string aDir,aNameFileIn; SplitDirAndFile(aDir,aNameFileIn,aNameIn); bool WithHypso = (aHypsoDyn>0) || (aNameCol != ""); // bool WithCol = (aNameCol != ""); if (aNameOut=="") aNameOut = StdPrefix(aNameIn) +std::string("Shade.tif"); Tiff_Im aFileIn = Tiff_Im::StdConvGen(aNameIn,1,true,false); if (aSzGlob== Pt2di(0,0)) aSzGlob = aFileIn.sz() -aP0Glob; Fonc_Num aFIn = aFileIn.in_gen(Tiff_Im::eModeCoulGray,Tiff_Im::eModeNoProl); { Tiff_Im ( aNameOut.c_str(), aSzGlob, GenIm::u_int1, Tiff_Im::No_Compr, WithHypso ? Tiff_Im::RGB : Tiff_Im::BlackIsZero ); } Tiff_Im aTifOut(aNameOut.c_str()); if (aSzMaxDalles.x<0) aSzMaxDalles = aSzGlob; Pt2di aPRD(aSzRecDalles,aSzRecDalles); cDecoupageInterv2D aDecoup ( Box2di(aP0Glob,aP0Glob+aSzGlob), aSzMaxDalles, Box2di(-aPRD,aPRD) ); Im2DGen aMnt = AllocImGen(aDecoup.SzMaxIn(),aTMNt); Im2DGen aShade = AllocImGen(aDecoup.SzMaxIn(),aTShade); cout << "SZ Max In " << aDecoup.SzMaxIn() << endl; REAL aRatio = ElMin(800.0/aSzGlob.x,700.0/aSzGlob.y); Video_Win * pW = aVisu ? Video_Win::PtrWStd(Pt2di(Pt2dr(aSzGlob)*aRatio)) : 0 ; aTetaH *= (2*PI)/360.0; anAzimut *= (2*PI)/360.0; for (int aKDec=0; aKDec<aDecoup.NbInterv() ; aKDec++) { Box2di aBoxIn = aDecoup.KthIntervIn(aKDec); Pt2di aSzIn = aBoxIn.sz(); Pt2di aP0In = aBoxIn.P0(); cout << "DEQ " << aDequant << "Sz In " << aSzIn <<endl; REAL aVMin; if (aDequant) { ElImplemDequantifier aDeq(aSzIn); aDeq.SetTraitSpecialCuv(true); aDeq.DoDequantif(aSzIn, trans(aFIn,aP0In),true); REAL aVMax; ELISE_COPY ( rectangle(Pt2di(0,0),aSzIn), aDeq.ImDeqReelle() * aFZ, aMnt.out() | VMax(aVMax) |VMin(aVMin) ); } else { ELISE_COPY ( rectangle(Pt2di(0,0),aSzIn), trans(aFIn,aP0In)*aFZ, aMnt.out()|VMin(aVMin) ); } Im2D_Bits<1> aIMasq(aSzIn.x,aSzIn.y,1); if (aFileMasq!="") { if (ELISE_fp::exist_file(aDir+aFileMasq)) aFileMasq = aDir+aFileMasq; double aDif=100; Tiff_Im aFM = Tiff_Im::StdConvGen(aFileMasq,1,true,false); ELISE_COPY ( select(rectangle(Pt2di(0,0),aSzIn),trans(!aFM.in_proj(),aP0In)), aVMin-aDif, aMnt.out() | (aIMasq.out() << 0) ); aVMin-= aDif; } if (aBrd>0) { cout << "VMin = " << aVMin <<endl; ELISE_COPY(aMnt.border(aBrd),aVMin-1000,aMnt.out()); } // Im2D_REAL4 aShade(aSzGlob.x,aSzGlob.y); ELISE_COPY(aShade.all_pts(),0,aShade.out()); if (pW) pW = pW->PtrChc(Pt2dr(aP0Glob-aP0In),Pt2dr(aRatio,aRatio)); REAL SPds = 0; REAL aSTot = 0; REAL Dyn = 1.0; if (aTShade != "u_int1") Dyn = 100; bool Done = false; if ( (aModeOmbre=="CielVu") || ((aModeOmbre=="Mixte") && (aVPdsFiltre[0] > 0.0)) ) { std::cout << "BEGIN CIEL" << endl; Done = true; for (int aK=0 ; aK< 2 ; aK++) { SPds = 0; for (int i=0; i<aNbDir; i++) { REAL Teta = (2*PI*i) / aNbDir ; Pt2dr U(cos(Teta),sin(Teta)); Pt2di aDir = Pt2di(U * (aNbDir * 4)); REAL Pds = (1-aPdsAnis) + aPdsAnis *ElSquare(1.0 - euclid(U,Pt2dr(0,1))/2); if (aK==1) Pds = (Pds*Dyn) / (2*aSTot); Symb_FNum Gr = (1-cos(PI/2-atan(gray_level_shading(aMnt.in())))) *255.0; cout << "Dir " << i << " Sur " << aNbDir << " P= " << Pds << endl; SPds += Pds; if (aK==1) { ELISE_COPY ( line_map_rect(aDir,Pt2di(0,0),aSzIn), Min(255*Dyn,aShade.in()+Pds*Gr), aShade.out() // | (pW ? (pW->ogray()<<(aShade.in()/SPds)) : Output::onul()) | (pW ? (pW->ogray()<<(Gr)) : Output::onul()) ); } } aSTot = SPds; } double aMul = (aModeOmbre=="Mixte") ? aVPdsFiltre[0] : 1.0; ELISE_COPY(aShade.all_pts(),aShade.in()*(aMul/SPds),aShade.out()); SPds = aMul; std::cout << "BEGIN CIEL" << endl; } if ( (aModeOmbre=="Local") || ((aModeOmbre=="Mixte") && (aVPdsFiltre[1] > 0.0)) ) { std::cout << "BEGIN LOCAL" << endl; Done = true; Fonc_Num aFonc = aMnt.in_proj(); Fonc_Num aMoy = aFonc; for (int aK=0 ; aK<aNbIterF; aK++) aMoy = canny_exp_filt(aMoy*aIMasq.in_proj(),aFactExp,aFactExp) / Max(0.1,canny_exp_filt(aIMasq.in_proj(),aFactExp,aFactExp)); double aMul = (aModeOmbre=="Mixte") ? aVPdsFiltre[1] : 1.0; ELISE_COPY ( rectangle(Pt2di(0,0),aSzIn), Max(0,Min(255, aShade.in() +(128+(aFonc-aMoy)*aDyn)* aMul)), aShade.out() ); SPds += aMul; std::cout << "END LOCAL" << endl; } if ( (aModeOmbre=="Med") || ((aModeOmbre=="Mixte") && (aVPdsFiltre[3] > 0.0)) ) { std::cout << "BEGIN MED" << endl; Done = true; Fonc_Num aFonc = round_ni(aMnt.in_proj()*aDynMed); int aVMax,aVMin; ELISE_COPY ( rectangle(Pt2di(-1,-1),aSzIn+Pt2di(1,1)), aFonc, VMin(aVMin)|VMax(aVMax) ); Fonc_Num aMoy = aFonc-aVMin; for (int aK=0 ; aK<aNbIterMed; aK++) aMoy = rect_median(aMoy,aNbMed,aVMax-aVMin+1); aMoy = aMoy + aVMin; double aMul = (aModeOmbre=="Mixte") ? aVPdsFiltre[3] : 1.0; ELISE_COPY ( rectangle(Pt2di(0,0),aSzIn), Max(0,Min(255, aShade.in() +(128+((aFonc-aMoy)*aDyn)/aDynMed)* aMul)), aShade.out() ); SPds += aMul; std::cout << "END MED" << endl; } if ( (aModeOmbre=="IgnE") || ((aModeOmbre=="Mixte") && (aVPdsFiltre[2] > 0.0)) ) { int aCpt=0; aCpt++; std::cout << "IGN E " << aCpt << " " << aKDec << "\n"; Done = true; if (aCpt>0) { Symb_FNum aGrad = deriche(aMnt.in_proj(),aDericheFact); Symb_FNum aGx = (aGrad.v0()); Symb_FNum aGy = (aGrad.v1()); Symb_FNum aNG = sqrt(1+Square(aGx)+Square(aGy)); Symb_FNum aNx (aGx/aNG); Symb_FNum aNy (aGy/aNG); Symb_FNum aNz (1/aNG); Pt2dr aDirS = Pt2dr::FromPolar(1.0,anAzimut) * Pt2dr(1,0); double aSx = aDirS.x * sin(aTetaH); double aSy = aDirS.y * sin(aTetaH); double aSz = cos(aTetaH); Symb_FNum aScal(aNx*aSx+aNy*aSy+aNz*aSz); std::cout << "AAAAAAAaa" << endl; double aMul = (aModeOmbre=="Mixte") ? aVPdsFiltre[2] : 1.0; ELISE_COPY ( rectangle(Pt2di(0,0),aSzIn), Max(0,aShade.in() + 255*aScal * aMul), aShade.out() ); SPds += aMul; std::cout << "BBBBbbb" << endl; } } if (! Done) { ELISE_ASSERT(false,"Unknown ModeOmbre"); } Fonc_Num aFoncRes = Max(0,Min(255,aShade.in()/SPds)); if (WithHypso) { Fonc_Num aFIntens = aFoncRes; Fonc_Num aFTeinte = trans(aFIn,aP0In)*aHypsoDyn; Fonc_Num aFSat = 255*aHypsoSat; if (aNameCol!="") { Tiff_Im aFileCol = Tiff_Im::StdConvGen(aDir+aNameCol,-1,true,false); Symb_FNum aFNC(trans(rgb_to_its(aFileCol.in()),aP0In)); if (aModeColor == "IntensShade") { aFIntens = aFoncRes; aFTeinte = aFNC.v1(); aFSat = aFNC.v2(); } else if (aModeColor == "BackRGB") { aFIntens = aIMasq.in()*aFoncRes + (1- aIMasq.in()) * aFNC.v0(); aFTeinte = aFNC.v1(); aFSat = aFNC.v2() * (1- aIMasq.in()); } else if (aModeColor == "GrayBackRGB") { aFIntens = aIMasq.in()*aFoncRes + (1- aIMasq.in()) * aFNC.v0(); aFTeinte = aFNC.v1(); aFSat = aFNC.v2()*(1-aIMasq.in()); } else { ELISE_ASSERT(false,"Unknown mode color"); } } aFoncRes = its_to_rgb(Virgule(aFIntens,aFTeinte,aFSat)); //aFoncRes = its_to_rgb(Virgule(aFoncRes,trans(aFIn,aP0In)*aHypsoDyn,255*aHypsoSat)); } /* if (WithCol) { Tiff_Im aFileCol(aNameCol.c_str()); Symb_FNum aFNC(trans(rgb_to_its(aFileCol.in()),aP0In)); aFoncRes = its_to_rgb(Virgule(aFoncRes,aFNC.v1(),aFNC.v2()*aHypsoSat)); // aFoncRes = aFileCol.in(); } */ // Tiff_Im::Create8BFromFonc(aNameOut,aShade.sz(),aShade.in()/SPds); cout << "WithHypso " << WithHypso << " DIM " << aFoncRes.dimf_out() << endl; Box2di aBoxOut = aDecoup.KthIntervOut(aKDec); ELISE_COPY ( rectangle(aBoxOut.P0()-aP0Glob,aBoxOut.P1()-aP0Glob), trans(aFoncRes,aP0Glob-aP0In), aTifOut.out() ); } return EXIT_SUCCESS; } else return EXIT_SUCCESS; }