Esempio n. 1
0
void cASAMG::TestDifProf(const cASAMG & aNE) const
{
    Im2D_REAL4 aImDif(mSz.x,mSz.y,1000);
    TIm2D<REAL4,REAL8> aTDif(aImDif);
    Pt2di anIndex;

    for (anIndex.x=0 ; anIndex.x <mSz.x ; anIndex.x++)
    {
        for (anIndex.y=0 ; anIndex.y <mSz.y ; anIndex.y++)
        {
             if (mTMasqN.get(anIndex))
             {
                 Pt3dr aPE = mStdN->PtOfIndex(anIndex);
                 aTDif.oset(anIndex,aNE.SignedDifProf(aPE));
             }
        }
    }
    Video_Win * aW = TheWinIm();
    if (aW)
    {
       ELISE_COPY
       (
           aImDif.all_pts(),
           Min(255,Abs(aImDif.in()*300)),
           aW->ogray()
       );
       aW->clik_in();
    }

}
Esempio n. 2
0
void VisuParalx(Video_Win aW,Fonc_Num f,REAL & aV0,REAL & aV1,bool CalcV)
{
   if (CalcV)	
       ELISE_COPY ( aW.all_pts(),Rconv(f),VMin(aV0) | VMax(aV1));

   ELISE_COPY
   (
        aW.all_pts(),
        AUC(round_ni((f-aV0) * (255.0/(aV1-aV0)))),
       aW.ogray()
   );
}
Esempio n. 3
0
void ShowIm2(Im2D_INT2 aZ,Video_Win aW)
{
    INT zMax,zMin;

    ELISE_COPY(aZ.all_pts(),aZ.in(),VMax(zMax)|VMin(zMin));
    cout << "Z  = [" << zMin << " , " << zMax << "]\n";

    ELISE_COPY
    (
        aZ.all_pts(),
        Max(0,Min(255,aZ.in())), // (aZ.in()-zMin) * (255.0/(zMax-zMin)),
        aW.ogray()
    );
}
Esempio n. 4
0
void cX11_Interface::DrawZoom(const Pt2dr & aPGlob)
{
     double aZoom = 10.0;

     Pt2dr aPIm = aPGlob- Pt2dr(mAppli->DecRech());
     Pt2dr aPMil = Pt2dr(mWZ->sz())/(2.0*aZoom);

     Video_Win aWC = mWZ->chc(aPIm-aPMil,Pt2dr(aZoom,aZoom));
     ELISE_COPY
     (
                aWC.all_pts(),
                mAppli->ImRechVisu().in(0),
                aWC.ogray()
     );

     aWC.draw_circle_abs(aPIm,4.0,Line_St(aWC.pdisc()(P8COL::blue),3.0));
}
Esempio n. 5
0
void lena_for_ever()
{
    Video_Display Ecr((char *) NULL);
    Gray_Pal       Pgray  (30);
    Disc_Pal       Pdisc  = Disc_Pal::P8COL();
    Elise_Set_Of_Palette    SOP(newl(Pgray)+Pdisc);


    Ecr.load(SOP);

    Video_Win W (Ecr,SOP,Pt2di(50,50),Pt2di(SZX,SZY));
    Elise_File_Im FLena("../IM_ELISE/lena",2,SXY,GenIm::u_int1,1,0);
    Im2D_U_INT1 I(SZX,SZY);

    ELISE_COPY
    (
        W.all_pts(),
        FLena.in(),
        W.ogray() | I.out()
    );

    bench_dilate_simple(W,I);
    bench_zonec_simple(W,I);
}
Esempio n. 6
0
Im2D_INT2  TestCoxRoy
           (
                INT         aSzV,
                Im2D_U_INT1 imG1,
                Im2D_U_INT1 imG2,
                Pt2di       aP0,
                Pt2di       aP1,
                INT         aParMin,
                INT         aParMax
           )
{
   ElTimer  aRoyTimer;
   TheP0 = aP0;
   Pt2di aSz = aP1 -aP0;
   Im2D_INT2  aRes (aSz.x,aSz.y);

   TheCorr = new EliseCorrel2D
                 (
                     imG1.in(0),
                     imG2.in(0),
                     imG1.sz(),
                     aSzV,
                     false,
                     -1,
		     true,
		     true
                 );

   Im2D_INT2 aIZMin(aSz.x,aSz.y,(INT2)(aParMin));
   Im2D_INT2 aIZMax(aSz.x,aSz.y,(INT2)(aParMax));

   cInterfaceCoxRoyAlgo * TheCRA = cInterfaceCoxRoyAlgo::NewOne
                (
                      aSz.x,
                      aSz.y,
                      aIZMin.data(),
                      aIZMax.data(),
                      false,
                      false
                );
    InitCostCoxRoy(*TheCRA);





   INT MpdFlow=0;
   if (false)
   {
      cInterfaceCoxAlgo * pSCA =     cInterfaceCoxAlgo::StdNewOne
		                     (
			                 aSz,
			                 0,
			                 aParMax-aParMin,
			                 2,
			                 false
			              );
      for (INT anX=aP0.x ; anX<aP1.x ; anX++)
          for (INT anY=aP0.y ; anY<aP1.y ; anY++)
              for (INT aZ=0 ; aZ<(aParMax-aParMin) ; aZ++)
	      {
		  Pt2di aP(anX,anY);
                  REAL aC = TheCorr->Correl(aP,aP+Pt2di(aZ+aParMin,0));
		  pSCA->SetCost(Pt3di(anX-aP0.x,anY-aP0.y,aZ),MakeCapa(1-aC));
	      }
      MpdFlow =  pSCA->PccMaxFlow();
      Im2D_INT2 aSol = pSCA->Sol(0);   
      Video_Win aW =  Video_Win::WStd(aSol.sz(),1.0);
      aW.set_title("MPD");
      INT aV0,aV1;
      ELISE_COPY(aSol.all_pts(),aSol.in(),VMin(aV0)|VMax(aV1));
      ELISE_COPY(aSol.all_pts(),(aSol.in()-aV0)*(255.0/(aV1-aV0)),aW.ogray());
      delete pSCA;
   }
   cout << "MPD Flow " << MpdFlow << "\n";





    aRoyTimer.reinit();
    INT aFl1 = TheCRA->TopMaxFlowStd(aRes.data());
    cout << "Roy Time = " << aRoyTimer.uval() << "\n";


    ELISE_COPY(aRes.all_pts(),aRes.in(),aRes.out());


    {
        INT aV0,aV1;
        ELISE_COPY(aRes.all_pts(),aRes.in(),VMin(aV0)|VMax(aV1));
        cout << "Cox Roy Interv = " << aV0  << " --- " << aV1 << "\n";
    }

    delete TheCRA;

    INT ecartPlani = 2;
    INT ecartAlti = 5;

    ELISE_COPY
    (
          aIZMin.all_pts(),
          rect_min(aRes.in(aParMax),ecartPlani) -ecartAlti,
          aIZMin.out()
    );
    ELISE_COPY
    (
          aIZMax.all_pts(),
          rect_max(aRes.in(aParMin),ecartPlani) +ecartAlti,
          aIZMax.out()
    );


   Im2D_INT2  aRes2 (aSz.x,aSz.y);
   TheCRA = cInterfaceCoxRoyAlgo::NewOne
                (
                      aSz.x,
                      aSz.y,
                      aIZMin.data(),
                      aIZMax.data(),
                      false,
                      false
                );
    InitCostCoxRoy(*TheCRA);

    aRoyTimer.reinit();
    INT aFl2 = TheCRA->TopMaxFlowStd(aRes2.data());
    cout << "Roy Time 2 = " << aRoyTimer.uval() << "\n";

    INT aNbDif;
    ELISE_COPY
    (
         aRes.all_pts(), 
         aRes.in()!=aRes2.in(),
         sigma(aNbDif)
    );
    BENCH_ASSERT(aNbDif==0);

    cout << "FLOWS : " << aFl1 << " " << aFl2 << "\n";
    cout << "Nb Dif = " << aNbDif << "\n";




    delete TheCorr;
    return aRes;
}
Esempio n. 7
0
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;
}
Esempio n. 8
0
void FiltreRemoveBorderHeter(Im2D_REAL4 anIm,Im2D_U_INT1 aImMasq,double aCostRegul,double aCostTrans)
{
    Pt2di aSz = anIm.sz();
    double aVMax,aVMin;

    ELISE_COPY(aImMasq.border(1),0,aImMasq.out());
    ELISE_COPY(aImMasq.all_pts(),aImMasq.in()!=0,aImMasq.out());
    ELISE_COPY(anIm.all_pts(),anIm.in(),VMax(aVMax)|VMin(aVMin));
    Video_Win * aW = Video_Win::PtrWStd(aSz);
    ELISE_COPY(anIm.all_pts(),(anIm.in()-aVMin) * (255.0/(aVMax-aVMin)),aW->ogray());
    std::cout << "VMAX " << aVMax << "\n";

    //ELISE_COPY(aW->all_pts(),aImMasq.in(),aW->odisc());
    //aW->clik_in();

    ELISE_COPY
    (
          aW->all_pts(),
          nflag_close_sym(flag_front8(aImMasq.in_proj()!=0)),
          aW->out_graph(Line_St(aW->pdisc()(P8COL::red)))
    );

    cParamFiltreDepthByPrgDyn aParam =  StdGetFromSI(Basic_XML_MM_File("DefFiltrPrgDyn.xml"),ParamFiltreDepthByPrgDyn);
    aParam.CostTrans() = aCostTrans;
    aParam.CostRegul() = aCostRegul;

    Im2D_Bits<1>  aNewMasq =  FiltrageDepthByProgDyn(anIm,aImMasq,aParam);
  
    ELISE_COPY
    (
         select(aNewMasq.all_pts(),aNewMasq.in()),
         2,
         aImMasq.out()
    );
    TIm2D<U_INT1,INT> aTMasq(aImMasq);
    FiltrageCardCC(false,aTMasq,2,0,100);

    Neighbourhood aNV4=Neighbourhood::v4();
    Neigh_Rel     aNrV4 (aNV4);

    ELISE_COPY
    (
           conc
           (
               select(select(aImMasq.all_pts(),aImMasq.in()==1),aNrV4.red_sum(aImMasq.in()==0)),
               aImMasq.neigh_test_and_set(aNV4,1,0,256)
           ),
           3,
           Output::onul()
    );



    ELISE_COPY
    (
         aNewMasq.all_pts(),
         aImMasq.in(),
         aW->odisc()
    );

/*
    ELISE_COPY
    (
          aW->all_pts(),
          nflag_close_sym(flag_front8(aNewMasq.in_proj())),
          aW->out_graph(Line_St(aW->pdisc()(P8COL::green)))
    );
*/


    aW->clik_in();

}
Esempio n. 9
0
void VisuGray(Video_Win aW,Fonc_Num aFonc)
{
    REAL aMax,aMin;
    ELISE_COPY(aW.all_pts(),Rconv(aFonc),VMax(aMax)|VMin(aMin));
    ELISE_COPY(aW.all_pts(),(aFonc-aMin)*255.0/(aMax-aMin),aW.ogray());
}
Esempio n. 10
0
void cElHJaPlan3D::Show
     (
          Video_Win aW,
          INT       aCoul,
          bool ShowDroite,
          bool ShowInterEmpr
     )
{
    if (aCoul >=0)
       ELISE_COPY(aW.all_pts(),aCoul,aW.ogray());

    Box2dr aBoxW(Pt2dr(0,0),Pt2dr(aW.sz()));
    for (INT aK=0; aK<INT(mVInters.size()) ; aK++)
    {
        cElHJaDroite * aDr =mVInters[aK];
	if (aDr)
	{
            ElSeg3D aSeg = aDr->Droite();
	    Pt3dr aQ0 = aSeg.P0();
	    Pt3dr aQ1 = aSeg.P1();
	    Pt2dr aP0(aQ0.x,aQ0.y);
	    Pt2dr aP1(aQ1.x,aQ1.y);

	    Seg2d aS(aP0,aP1);
            Seg2d aSC = aS.clipDroite(aBoxW);
            if (ShowDroite && (! aSC.empty()))
            {
	       aW.draw_seg(aSC.p0(),aSC.p1(),aW.pdisc()(P8COL::magenta));
            }
	}
    }

    tFullSubGrPl aSGrFul;
    if (ShowInterEmpr)
    {
        for (tItSomGrPl itS=mGr->begin(aSGrFul) ; itS.go_on() ; itS++)
	{
            aW.draw_circle_loc
            (
                (*itS).attr().Pt(),
                4.0,
                aW.pdisc()(P8COL::blue)
            );
	    for (tItArcGrPl itA=(*itS).begin(aSGrFul) ; itA.go_on() ; itA++)
	    {
                 tSomGrPl &s1 = (*itA).s1();
                 tSomGrPl &s2 = (*itA).s2();
		 if (&s1 < &s2)
		 {
                     aW.draw_seg
                     (
                         s1.attr().Pt(),
                         s2.attr().Pt(),
                        aW.pdisc()(P8COL::black)
                     );
		 }
	    }
	}
    }

    // for (INT aK=0 ; aK<INT(mFacOblig.size()) ; aK++)
    //    mFacOblig[aK]->Show(PI/2.0,P8COL::cyan,false);
}