Box2di cWindowXmlEditor::TopDraw() { ELISE_COPY(mW.all_pts(),mGrayFond,mW.ogray()); int aTx = mW.sz().x; // int aXMil = aTx/2; if (mFirstDraw) { mCaseQuit = cCaseX11Xml::Alloc(mW,Box2di(Pt2di(10,10),Pt2di(200,40)),P8COL::magenta); mCaseWarn = cCaseX11Xml::Alloc(mW,Box2di(Pt2di(10,2),Pt2di(aTx-2,48)),P8COL::red); mVCase.push_back(mCaseQuit); mVInfoCase.push_back(cWXXInfoCase(0,0)); } Box2di aRes = Draw(Pt2di(50,50),mTreeGlob,0,mFilterGlob); mFirstDraw = false; for (int aKC=0 ; aKC<int(mVCase.size()) ; aKC++) { cCaseX11Xml * aCX = mVCase[aKC]; aCX->Efface(); cWXXInfoCase & anIC = mVInfoCase[aKC]; cElXMLTree * aTree = anIC.mTree; if (aTree) aCX->string(-10,anIC.mTree->GetUniqueVal()); } ShowQuit(); return aRes; }
Box2di cWindowXmlEditor::PrintTag(Pt2di aP0,cElXMLTree * aTree,int aMode,int aLevel,cElXMLTree * aFilter) { if ((!mXmlMode) && (aMode!=0)) return Box2di(aP0-Pt2di(0,1),aP0-Pt2di(0,1)); std::string aTag = ((aMode == -1) ? "</" : "<") + aTree->ValTag() + ((aMode==0) ? "/>" : ">"); if (!mXmlMode) aTag = " " + aTree->ValTag() + " : "; Pt2di aSz = mW.SizeFixedString(aTag); Pt2di aP1 = aP0 + aSz; mW.fill_rect(Pt2dr(aP0)-Pt2dr(1,1),Pt2dr(aP1)+Pt2dr(1,1),mW.pgray()(mGrayTag)); if (aMode!=0) mW.draw_rect(Pt2dr(aP0)-Pt2dr(2,2),Pt2dr(aP1)+Pt2dr(2,2),Line_St(mW.pdisc()(P8COL::blue),2)); mW.fixed_string(Pt2dr(aP0)+Pt2dr(0,aSz.y), aTag.c_str(),mW.pdisc()(P8COL::black),false); Box2di aRes (aP0-mPRab,aP1+ mPRab); if ((aMode ==0) && mFirstDraw) { Pt2di aQ0 (aP0.x+aSz.x+5,aP0.y-4); Pt2di aQ1 (EndXOfLevel(aLevel)-5,aP0.y+aSz.y+4); mVCase.push_back(cCaseX11Xml::Alloc(mW,Box2di(aQ0,aQ1),P8COL::yellow)); mVInfoCase.push_back(cWXXInfoCase(aTree,aFilter)); } return aRes; }
void cWindowXmlEditor::ShowWarn(const std::string& aMes1, const std::string& aMes2) { mCaseWarn->Efface(P8COL::red); mW.fixed_string_middle(Box2di(Pt2di(0,5),Pt2di(mW.sz().x,20)),0,aMes1,mW.pdisc()(P8COL::black),true); mW.fixed_string_middle(Box2di(Pt2di(0,25),Pt2di(mW.sz().x,40)),0,aMes2,mW.pdisc()(P8COL::black),true); mCaseWarn->clik_in(); mCaseWarn->Efface(mW.pgray()(mGrayFond)); ShowQuit(); }
Fonc_Num RectKth_Pondere ( Fonc_Num f1, Fonc_Num f2, REAL kth, INT side, INT max_vals ) { cout << "!!!!!!!!!!!!!!!!!!!!! Non benche !!!!!!!!!!!!\n"; ELISE_ASSERT ( (f1.dimf_out()==1) && (f2.dimf_out() ==1), "Bad Dim in Rect_Pondere" ); Pt2di PSz(side,side); return new Kieme_Opb_Not_Comp ( Virgule(f1,f2), kth, Box2di(-PSz,PSz), max_vals, Histo_Kieme::KTH, Histo_Kieme::undef, false, true ); }
Can_Exp_OPB_Comp::Can_Exp_OPB_Comp ( const Arg_Fonc_Num_Comp & arg, INT dim_out, Fonc_Num f0, REAL fx, REAL fy, INT nb, bool rec_ar, bool double_sens ) : Fonc_Num_OPB_TPL<REAL> ( arg, dim_out, Arg_FNOPB(f0,Box2di(Pt2di(0,0),Pt2di(0,nb))) ), _fx (fx), _fy (fy), _nb (nb), _rec_arr (rec_ar), _double_sens (double_sens), _cptl (0) { _buf_exp_x = NEW_VECTEUR(_x0,_x1,REAL); _cumul_line_av = NEW_MATRICE(Pt2di(_x0,0),Pt2di(_x1,_dim_out),REAL); if (_rec_arr) { _buf_rec_arr = NEW_TAB_MATRICE(_dim_out,Pt2di(_x0,1),Pt2di(_x1,_nb+1),REAL); _correc_arr = NEW_MATRICE(Pt2di(_x0,0),Pt2di(_x1,_dim_out),REAL); } }
Fonc_Num skeleton_gen(Fonc_Num f,INT max_d,L_ArgSkeleton larg,bool AvecDist) { Data_ArgSkeleton askel(10,10,larg); INT d = (max_d + 1)/2 + 2; // euclid dist if (askel._ang >0) { REAL da = (d * 1.2) / cos(atan(askel._ang+1)) +2; d = std::max (d,round_up(da)); } d = std::max(d,askel._surf+2); INT per_reaf = (INT) (3 * d) + 5; per_reaf = std::max(per_reaf,500); return create_op_buf_simple_tpl ( new Skel_OPB_Comp(larg,AvecDist), f, AvecDist ? 2 : f.dimf_out(), Box2di(d), per_reaf ); }
void ModelDiffBox::MakeIt(Box2di OldOne,Box2di NewOne) { mInterIsEmpty = mEnPlus.MakeIt(NewOne,OldOne); mEnMoins.MakeIt(OldOne,NewOne); if (!mInterIsEmpty) { mInter = Box2di(Inf(OldOne._p0,NewOne._p0),Sup(OldOne._p1,NewOne._p1)); } }
Fonc_Num rect_median ( Fonc_Num f, Pt2di p, INT max_vals, bool aCatInit, bool aModePond, Histo_Kieme::mode_h aModeH ) { return rect_median (f,Box2di(-p,p),max_vals,aCatInit,aModePond,aModeH); }
template <class Type,class TypeB> void bench_r2d_assoc ( const OperAssocMixte & op, Type *, TypeB *, Pt2di sz, INT x0, INT x1 ) { Im2D<Type,TypeB> I(sz.x,sz.y,(Type)0); Im2D_REAL8 R1(sz.x,sz.y,0.0); Im2D_REAL8 R2(sz.x,sz.y,0.0); Im2D_REAL8 R3(sz.x,sz.y,0.0); ELISE_COPY(I.all_pts(),255*frandr(),I.out()); ELISE_COPY ( I.all_pts(), linear_red(op,I.in(),x0,x1), R1.out() ); TypeB vdef; op.set_neutre(vdef); ELISE_COPY ( I.all_pts(), rect_red(op,I.in(vdef),Box2di(Pt2di(x0,0),Pt2di(x1,0))), R2.out() ); ELISE_COPY ( I.lmr_all_pts(Pt2di(1,0)), linear_red(op,I.in(),x0,x1), R3.out() ); REAL d12,d23; ELISE_COPY ( R1.all_pts(), Virgule( Abs(R1.in()-R2.in()), Abs(R2.in()-R3.in()) ), Virgule(VMax(d12),VMax(d23)) ); BENCH_ASSERT((d12<epsilon)&&(d23<epsilon)); }
Fonc_Num rect_kth ( Fonc_Num f, double kth, Pt2di side, INT max_vals, bool aCatInit, bool aModePond, Histo_Kieme::mode_h aModeH ) { return rect_kth(f,kth,Box2di(-side,side),max_vals,aCatInit,aModePond,aModeH); }
void xml_init(Box2di & aVal,cElXMLTree * aTree) { int aNb = sscanf ( aTree->Contenu().c_str(), "%d %d %d %d %s", &aVal._p0.x, &aVal._p0.y, &aVal._p1.x, &aVal._p1.y, aBuf ); aVal = Box2di(aVal._p0,aVal._p1); ELISE_ASSERT(aNb==4,"Bad Nb Value in xml_init (double)"); }
Arg(Flux_Pts flx) : b (Pt2di(0,0),Pt2di(0,0)) { pts = Std_Pack_Of_Pts<INT>::new_pck(2,1000); ELISE_COPY ( flx, Virgule(FX,FY), push_values(&pts) ); b = Box2di(pts->_pts[0],pts->_pts[1],pts->nb()); b._p1 = b._p1 + Pt2di(1,1); }
template <class Type> Fonc_Num Tfonc_a_trou(Fonc_Num f,Liste_Pts<Type,INT> l) { Tjs_El_User.ElAssert ( f.dimf_out() <= l.dim()-2, EEM0 << "fonc_a_trou : Fonc_Num.dimf_out() > Liste_Pts.dim()-2" ); return create_op_buf_simple_tpl ( new FoncATrou_OPB_Comp<Type> (l), 0, f, l.dim()-2, Box2di(0) ); }
Flux_Pts_Computed * Quick_Flux_Poly_NoComp::compute(const Arg_Flux_Pts_Comp & arg) { ELISE_ASSERT(!mLPts.empty(),"Empty liste in quick poly"); Pt2di aP0 = mLPts.car(); Pt2di aP1 = mLPts.car(); std::vector<Pt2di> aVpts; for (ElList<Pt2di> aL= mLPts ;!aL.empty(); aL = aL.cdr()) { Pt2di aP = aL.car(); aVpts.push_back(aP); aP0.SetInf(aP); aP1.SetSup(aP); } Flux_Pts_Computed * res = new Quick_Flux_Poly_Comp(aVpts,Box2di(aP0,aP1)); return split_to_max_buf(res,arg); }
static Im2D_REAL4 XParalaxe() { Im2D_REAL4 aRes(SzI.x,SzI.y); if (ImCox) return aRes; INT NbLab = 5; Fonc_Num FLab = Min(NbLab-1,Iconv(frandr() * NbLab)); for (INT k=0; k< 6 ; k++) FLab = label_maj(FLab,NbLab,Box2di(8)); ELISE_COPY ( aRes.all_pts(), (unif_noise_4(8) -0.5) * 18.0 + (FLab -(NbLab-1)/2.0) * 0, aRes.out() ); return aRes; }
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; }
Box2di R2I(const Box2dr & aB) { return Box2di(round_ni(aB._p0),round_ni(aB._p1)); }
void ModelBoxSubstr::AddBox(Pt2di p0,Pt2di p1) { mBoxes[mNbBox++] = Box2di(p0,p1); }
Box2di Scale_Im_Compr<TObj,TLut,TInd>::do_it ( Pt2dr tr, REAL sc, Pt2di pW0, Pt2di pW1, bool quick ) { if (! this->do_it_gen(tr,sc,pW0,pW1)) return Box2di(pW0,pW0); for (INT c=0; c<this->_nb_chan ; c++) for (INT x=-(Scale_Im_Compr<TObj,TLut,TInd>::RAB); x< (Scale_Im_Compr<TObj,TLut,TInd>::RAB)+this->_SzW.x ; x++) this->_line[c][x] = 0; { for (INT ux=this->_xU0; ux<=this->_xU1 ; ux++) { INT pixW = this->PremPixelU2WX(ux); if (pixW == this->_u2wX[ux]) { REAL p0 = ElPixelCentre::LenghFromFinIntervPixelIncluant (this->x_to_window(ElPixelCentre::DebIntervalPixel(ux))) ; _RLE_Pds_0[ux] = round_ni(this->_CoeffPds*p0); _RLE_Pds_1[ux] = this->_CoeffPds-_RLE_Pds_0[ux]; } else if (pixW > this->_u2wX[ux]) { _RLE_Pds_0[ux] = 0; _RLE_Pds_1[ux] = this->_CoeffPds; } else if (pixW < this->_u2wX[ux]) { _RLE_Pds_0[ux] = this->_CoeffPds; _RLE_Pds_1[ux] = 0; } } } { for (INT ux=this->_xU0; ux<this->_xU1 ; ux++) { INT pixW = this->PremPixelU2WX(ux); if (pixW == this->_u2wX[ux]) { if (this->_u2wX[ux] == this->_u2wX[ux+1]) { _LIT_Pds_0[ux] = _RLE_Pds_0[ux]-_RLE_Pds_0[ux+1]; _LIT_Pds_1[ux] = -_LIT_Pds_0[ux]; _LIT_Pds_2[ux] = 0; } else { _LIT_Pds_0[ux] = _RLE_Pds_0[ux]; _LIT_Pds_2[ux] = -_RLE_Pds_1[ux+1]; _LIT_Pds_1[ux] = -(_LIT_Pds_0[ux]+_LIT_Pds_2[ux]); } } else { _LIT_Pds_0[ux]=0; _LIT_Pds_1[ux]=0; _LIT_Pds_2[ux]=0; } } } if ((sc < 1.0) && (! quick)) DoItReduce(); else { DoItZoom(); } return Box2di(pW0,pW1); }
Simple_Buffered_Op_Comp<Tout,Tin>::Simple_Buffered_Op_Comp ( const Arg_Fonc_Num_Comp & arg, INT dim_out, Fonc_Num f0, Box2di side_0, Simple_OPBuf1<Tout,Tin> * calc, INT nb_pack_y, bool aCatFoncInit ) : Fonc_Num_OPB_TPL<Tout> ( arg, dim_out, Arg_FNOPB ( f0, Box2di ( side_0._p0, side_0._p1+Pt2di(0,nb_pack_y-1) ), type_of_ptr((const Tin *)0) ), Arg_FNOPB::def, Arg_FNOPB::def, aCatFoncInit ), _calc (0), _pcalc (0) { calc->_first_line = true; calc->_ycur = this->_y0; calc->_nb_pack_y = nb_pack_y; calc->_y_in_pack = 0; calc->_x0 = this->_x0; calc->_x1 = this->_x1; calc->_y0 = this->_y0; calc->_y1 = this->_y1; calc->_dx0 = side_0._p0.x; calc->_dy0 = side_0._p0.y; calc->_dx1 = side_0._p1.x; calc->_dy1 = side_0._p1.y; calc->_x0Buf = calc->_x0 + calc->_dx0; calc->_x1Buf = calc->_x1 + calc->_dx1; calc->_y0Buf = calc->_dy0; calc->_y1Buf = calc->_dy1 + nb_pack_y; calc->_dim_in = f0.dimf_out(); calc->_dim_out = this->idim_out(); calc->_integral = this->integral(); _calc = calc->dup_comp(); _calc->_first_line =calc->_first_line; _calc->_ycur = calc->_ycur; _calc->_x0 = calc->_x0; _calc->_x1 = calc->_x1; _calc->_y0 = calc->_y0; _calc->_y1 = calc->_y1; _calc->_dx0 = calc->_dx0; _calc->_dx1 = calc->_dx1; _calc->_dy0 = calc->_dy0; _calc->_dy1 = calc->_dy1; _calc->_x0Buf = calc->_x0Buf; _calc->_x1Buf = calc->_x1Buf; _calc->_y0Buf = calc->_y0Buf; _calc->_y1Buf = calc->_y1Buf; _calc->_nb_pack_y = calc->_nb_pack_y; _calc->_y_in_pack = calc->_y_in_pack; _calc->_dim_in = calc->_dim_in ; _calc->_dim_out = calc->_dim_out ; _calc->_integral = calc->_integral; _pcalc = PRC_Simple_OPBuf1<Tout,Tin>(_calc); }
Box2di R2ISup(const Box2dr & aB) { return Box2di(round_down(aB._p0),round_up(aB._p1)); }
static Box2di BoxRand(Pt2di sz) { return Box2di(PtRand(sz),PtRand(sz)); }
void cOctaveDigeo::SetBoxInOut(const Box2di & aBoxIn,const Box2di & aBoxOut) { mBoxCurIn = Box2dr(Pt2dr(aBoxIn._p0)/mNiv,Pt2dr(aBoxIn._p1)/mNiv); mBoxCurOut = Box2di(aBoxOut._p0/mNiv,aBoxOut._p1/mNiv); }
cElNuage3DMaille * cElNuage3DMaille::FromParam ( const cXML_ParamNuage3DMaille & aParamOri, const std::string & aDir, const std::string & aMasqSpec, double ExagZ, const cParamModifGeomMTDNuage * aPMG, bool WithEmptyData ) { cXML_ParamNuage3DMaille aParam = aParamOri; Box2di aBox(Pt2di(0,0),aParam.NbPixel()); bool Dequant = false; if (aPMG) { double aScale = aPMG->mScale; if (aScale != 1.0) { std::string aMes = "Scale=" + ToString(aScale); cElWarning::ScaleInNuageFromP.AddWarn(aMes,__LINE__,__FILE__); } Pt2di aP0 = round_down(aPMG->mBox._p0/aScale); Pt2di aP1 = round_up(aPMG->mBox._p1/aScale); aBox = Inf(aBox,Box2di(aP0,aP1)); aParam.NbPixel() = aBox.sz(); ElAffin2D aAfM2C = Xml2EL(aParam.Orientation().OrIntImaM2C()); aAfM2C = ElAffin2D::trans(-Pt2dr(aBox._p0)) * aAfM2C; aParam.Orientation().OrIntImaM2C().SetVal(El2Xml(aAfM2C)); Dequant = aPMG->mDequant; } std::string aMasq = aDir+aParam.Image_Profondeur().Val().Masq(); if (aMasqSpec!="") aMasq = aMasqSpec; GenIm::type_el aTypeEl = GenIm::real4; Fonc_Num aFMasq = 0; Fonc_Num aFProf = 1; if (! WithEmptyData) { aFMasq = trans(Tiff_Im::BasicConvStd(aMasq).in(0),aBox._p0); Tiff_Im aTP = Tiff_Im::BasicConvStd(aDir+aParam.Image_Profondeur().Val().Image()); aFProf = trans(aTP.in_proj()*ExagZ,aBox._p0); aTypeEl = aTP.type_el(); } if (aParam.Image_Profondeur().IsInit()) { bool aFaiscClassik = ( (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTFaisceauIm1PrCh_Px1D) || (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTFaisceauIm1PrCh_Px2D) || (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTEuclid) || (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTFaisceauPrChSpherik) ); bool aProfIsZ = ( (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTFaisceauIm1ZTerrain_Px1D) || (aParam.Image_Profondeur().Val().GeomRestit()==eGeomMNTFaisceauIm1ZTerrain_Px2D) ); if (aFaiscClassik || aProfIsZ) { switch (aTypeEl) { case GenIm::int2 : if (Dequant) return new cElN3D_EpipGen<float,double>(aDir,aParam,aFMasq,aFProf,aProfIsZ,WithEmptyData,true); else return new cElN3D_EpipGen<INT2,INT>(aDir,aParam,aFMasq,aFProf,aProfIsZ,WithEmptyData,false); break; case GenIm::real4 : return new cElN3D_EpipGen<float,double>(aDir,aParam,aFMasq,aFProf,aProfIsZ,WithEmptyData,false); break; default : std::cout << "NAME " << aDir+aParam.Image_Profondeur().Val().Image() << "\n"; ELISE_ASSERT(false,"Type Image non gere dans cElNuage3DMaille::FromParam"); break; } } } ELISE_ASSERT(false,"cElNuage3DMaille::FromParam"); return 0; }