void cICL_Courbe::AddSeg
                  (
		      Pt2dr P0,
		      bool  isP0OnCerle,
		      Pt2dr P1,
		      bool  isP1OnCerle
                  )
{		  
    if (pW)
    {
        pW->draw_arrow
        (
	    ToLoc(P0),
            ToLoc(P1),
            Line_St(pW->pdisc()(P8COL::blue),2),
            Line_St(pW->pdisc()(P8COL::blue),2),
	    10.0
        );
        pW->draw_circle_loc
        (
           ToLoc(P0),
           5.0,
           pW->pdisc()(isP0OnCerle?P8COL::yellow : P8COL::green)
        );
        pW->draw_circle_loc
        (
           ToLoc(P1),
           5.0,
           pW->pdisc()(isP1OnCerle?P8COL::yellow : P8COL::green)
        );
    }

    mVArcs.push_back(cICL_Arc(P0,isP0OnCerle,P1,isP1OnCerle));
}
Exemplo n.º 2
0
void cElHJaFacette::Show(REAL aDirH,INT aCoul,bool WithBox)
{
   Video_Win aW = *(mPlan->W());
   aW.hach(mVPt,Pt2dr::FromPolar(1.0,aDirH),3.0,aW.pdisc()(aCoul));
   if (WithBox)
   {
      aW.draw_rect(mBox._p0,mBox._p1,aW.pdisc()(aCoul));
   }
}
std::vector<Pt2dr> cICL_Courbe::GetPoly(INT NbPtsMax,bool ForceLosange)
{
    ELISE_ASSERT(pW!=0,"cICL_Courbe::GetPoly()");
    static bool First = true;
    if (! First)
        pW->clik_in();
    First = false;
    pW->clear();
    pW->draw_circle_loc
    (
        ToLoc(Pt2dr(0,0)),
        mScale,
        pW->pdisc()(P8COL::red)
    );
    std::vector<Pt2dr> aRes;

    while (true)
    {
        Clik aCl = pW->clik_in();
	Pt2dr aP = (Pt2dr(aCl._pt)-mP0) / mScale;

	if (NbPtsMax-1 == INT(aRes.size()))
            aCl._b = 3;

	if (ForceLosange && (aRes.size()==3))
        {
            aP = aRes[0]+ aRes[2] - aRes[1];
            aCl._b = 3;
	}
        pW->draw_circle_loc(ToLoc(aP),3.0,pW->pdisc()(P8COL::green));
        
	 if (! aRes.empty())
            pW->draw_seg(ToLoc(aRes.back()),ToLoc(aP),pW->pdisc()(P8COL::green));

	 aRes.push_back(aP);

	 if (aCl._b == 3)
	 {
            pW->draw_seg(ToLoc(aRes[0]),ToLoc(aP),pW->pdisc()(P8COL::green));
	    return aRes;
	 }
    }
    return aRes;
}
Exemplo n.º 4
0
void cAppliOptimTriplet::ShowPoint(cImOfTriplet * aIm,Pt2df aP,int aCoul,int aRay)
{
     Video_Win * aW = aIm->W();
     if (aW)
     {
        Pt2dr aPr(aP.x,aP.y);
        aPr = aIm->Im()->CS()->R3toF2(PZ1(aPr));
        aW->draw_circle_abs(aPr,aRay,Line_St(aW->pdisc()(aCoul)));
     }
}
Exemplo n.º 5
0
void cEtalonnage::TestVisuFTM()
{
   
    INT aSzPh = 4100;
    INT aSz = 800;
    REAL aZ =  aSz / REAL(aSzPh);
    Video_Win  aW = Video_Win::WStd(Pt2di(aSzPh,aSzPh),aZ);


    std::vector<std::string> mVNames = mParam.AllImagesCibles();
    for
    (
           std::vector<string>::const_iterator iTN = mVNames.begin();
           iTN != mVNames.end();
           iTN++
    )
    {
        std::string aName = NamePointeResult(*iTN,false,true);
        cout <<  aName << "\n";
        ELISE_fp aFile(aName.c_str(),ELISE_fp::READ);
        string buf;
        bool GotEOF = false;

        while (! GotEOF)
        {
            //aFile.fgets(buf,NbBuf,GotEOF,false);
		aFile.fgets(buf,GotEOF);
            if (GotEOF)
            {
            }
            if ((!GotEOF) && (buf[0] != '#'))
            {
               INT anId;
               REAL anX,anY,aL;
               sscanf(buf.c_str(),"%d %lf %lf %lf",&anId,&anX,&anY,&aL);
               if (anId>=0)
               {
                   INT aCoul = P8COL::red;
                   if (aL > 1.0)  aCoul = P8COL::blue;
                   if (aL > 1.5)  aCoul = P8COL::green;
                   aW.draw_circle_abs
                   (
                       Pt2dr(anX,anY),
                       aL*10.0,
                       aW.pdisc()(aCoul)
                   );
               }
            }
        }

    }
    getchar();
}
Exemplo n.º 6
0
void PutFileText(Video_Win aW,const std::string & aName)
{
   ELISE_fp  aFile (aName.c_str(),ELISE_fp::READ);

   int aCpt=0;
   
   char * aCstr = 0;
   while ((aCstr = aFile.std_fgets()))
   {
       aW.fixed_string(Pt2dr(10,15*aCpt +20),aCstr,aW.pdisc()(P8COL::black),true);
       aCpt++;
   }
   aFile.close();
}
Exemplo n.º 7
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));
}
Exemplo 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();

}
Exemplo n.º 9
0
void cASAMG::ComputeSubset(int aNbPts,cResumNuage & aRN)
{
   Video_Win * aW = mAppli->Param().VisuLowPts().Val() ?   TheWinIm() : 0;

   double aSzCel = sqrt(double(mSz.x*mSz.y)/aNbPts);
   Pt2di aNb2C = round_up(Pt2dr(mSz)/aSzCel);
   Pt2di aPK;

   Im2D_U_INT1 anImDist(mSz.x,mSz.y);
   TIm2D<U_INT1,INT> aTDist(anImDist);
   ELISE_COPY(mMasqN.all_pts(),mMasqN.in(),anImDist.out());

   Chamfer::d32.im_dist(anImDist);


   if (aW)
   {
      ELISE_COPY(anImDist.all_pts(),mStdN->ImDef().in()!=0,aW->odisc());
      ELISE_COPY(select(anImDist.all_pts(),anImDist.in()>0),P8COL::blue,aW->odisc());
      ELISE_COPY(select(anImDist.all_pts(),anImDist.in()>10),P8COL::yellow,aW->odisc());
   }

   int aNbSomTot  = 0;
   std::vector<Pt2di> aVPts;
   std::vector<int>   aVNb;
   for (aPK.x=0 ; aPK.x<aNb2C.x ; aPK.x++)
   {
       Pt2di aP0,aP1;
       aP0.x = (aPK.x*mSz.x)     / aNb2C.x;
       aP1.x = ((aPK.x+1)*mSz.x) / aNb2C.x;
       for (aPK.y=0 ; aPK.y<aNb2C.y ; aPK.y++)
       {
           aP0.y = (aPK.y*mSz.y)     / aNb2C.y;
           aP1.y = ((aPK.y+1)*mSz.y) / aNb2C.y;

           Pt2di aP;

           Pt2dr aPMoy(0,0);
           int aNbSom=0;
           if (aW)
           {
               aW->draw_rect(Pt2dr(aP0),Pt2dr(aP1),Line_St(aW->pdisc()(P8COL::green)));
           }
           for (aP.x=aP0.x; aP.x<aP1.x ; aP.x++)
           {
               for (aP.y=aP0.y; aP.y<aP1.y ; aP.y++)
               {
                  if (mTMasqN.get(aP))
                  {
                     aPMoy = aPMoy + Pt2dr(aP);
                     aNbSom++;
                  }
               }
           }
           if (aNbSom>0)
           {
              aPMoy = aPMoy/double(aNbSom);
              double aDBest = 1e10;
              Pt2di aPBest(0,0);
              for (aP.x=aP0.x; aP.x<aP1.x ; aP.x++)
              {
                  for (aP.y=aP0.y; aP.y<aP1.y ; aP.y++)
                  {
                     if (mTMasqN.get(aP))
                     {
                        double aDist = euclid(Pt2dr(aP),aPMoy) - std::min(6,aTDist.get(aP))/1.8;

                        if (aDist<aDBest)
                        {
                           aDBest = aDist;
                           aPBest = aP;
                        }
                     }
                  }
              }
              aVPts.push_back(aPBest);
              aVNb.push_back(aNbSom);
/*
              cLinkPtFuNu aPF(aPBest.x,aPBest.y,aNbSom);
              aVPTR.push_back(aPF);
*/
              aNbSomTot += aNbSom;
              if (aW)
              {
                  aW->draw_circle_abs(Pt2dr(aPBest),3.0,aW->pdisc()(P8COL::red));
              }
           }
       }
   }

   aRN.Reset(aVPts.size());
   aRN.mNbSom = aNbSomTot;
   for (int aK=0 ; aK<int(aVPts.size()); aK++)
   {
      aRN.mVX.push_back(aVPts[aK].x);
      aRN.mVY.push_back(aVPts[aK].y);
      aRN.mVNb.push_back(aVNb[aK]);
   }

   if (aW)   
   {
       //  aW->clik_in();
   }
}
Exemplo n.º 10
0
void cElHJaFacette::ShowCont(INT aCoul,Video_Win aW)
{
    INT aNb = (int) mVPt.size();
    for (INT aK=0 ; aK<aNb ; aK++)
        aW.draw_seg(mVPt[aK],mVPt[(aK+1)%aNb],aW.pdisc()(aCoul));
}
Exemplo n.º 11
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);
}