Output Video_Win::WiewAv(Pt2di sz,Pt2di szmax)
{
    REAL zoom = ElMin(szmax.x/(REAL)sz.x,szmax.y/(REAL)sz.y);

    Video_Win res  = WStd(sz,zoom,false);

    Video_Win w0 = res.chc(Pt2dr(0,0),Pt2dr(1,1));
    ELISE_COPY(w0.all_pts(),P8COL::black,w0.odisc());
    return res.odisc() << (int) P8COL::red;
}
Example #2
0
void cX11_Interface::Init()
{

//SetImagesPriority(0,);

    InitNbWindows();

    Pt2di aSzF =  mParam->SectionWindows().SzTotIm().Val().dcbyc(mNb2W);;

    int aCpt=0;
    Video_Win * aLastW   = 0;
    Video_Win * aLastWX0 = 0;
    Video_Win * aWTitle  = 0;
    Video_Win * aWY0XMax = 0;
    Pt2di aSzTitle(aSzF.x,15);
    for (int aKY =0 ; aKY<mNb2W.y ; aKY++)
    {
        for (int aKX =0 ; aKX<mNb2W.x ; aKX++)
        {
            if (aCpt<mNbW)
            {
                Video_Win * aRes = 0;
                if (aCpt==0)
                {
                    aWTitle = Video_Win::PtrWStd(aSzTitle,true);
                    aRes = new Video_Win(*aWTitle,Video_Win::eBasG,aSzF);
                    // aRes = Video_Win::PtrWStd(aSzF,true);
                    aLastWX0 = aRes;
                    mDisp = new Video_Display(aRes->disp());
                }
                else
                {
                    if (aKX==0)
                    {
                        aWTitle = new Video_Win(*aLastWX0,Video_Win::eBasG,aSzTitle);
                        aRes = new Video_Win(*aWTitle,Video_Win::eBasG,aSzF);
                        aLastWX0 = aRes;
                    }
                    else
                    {
                        aWTitle = new Video_Win(*aLastW,Video_Win::eDroiteH,aSzTitle);
                        aRes = new Video_Win(*aWTitle,Video_Win::eBasG,aSzF);
                    }

                }
                ELISE_COPY(aWTitle->all_pts(),P8COL::yellow,aWTitle->odisc());
                ELISE_COPY(aRes->all_pts(),P8COL::blue,aRes->odisc());
                aLastW = aWTitle;
                mWins.push_back(new cWinIm(*mAppli,*aRes,*aWTitle,*mAppli->imageVis(aCpt)));
                if ((aKY==0) && (aKX==(mNb2W.x -1)))
                {
                    aWY0XMax = aWTitle;
                }
            }
            aCpt++;
        }
    }

    Pt2di zoomWindowSize = mParam->SectionWindows().SzWZ().ValWithDef(round_ni(Pt2dr(mParam->SzTotIm().Val())*0.6));
    mWZ =  new Video_Win(*aWY0XMax,Video_Win::eDroiteH, zoomWindowSize);
    mZFON = new cFenOuiNon(*mWZ,Pt2di(200,20));

    mVNameCase.push_back( cCaseNamePoint("Cancel",eCaseCancel) );

    if (mParam->EnterName().Val())
    {
        mVNameCase.push_back( cCaseNamePoint("Enter New",eCaseSaisie) );
    }

    InitVNameCase();

    mMenuNamePoint = new cFenMenu(*mWZ,Pt2di(120,20),Pt2di(1,mVNameCase.size()));

    if (mParam->EnterName().Val())
    {
        mWEnter =  new Video_Win(mMenuNamePoint->W(),Video_Win::eDroiteH,Pt2di(150,20));
        mWEnter->move_translate(Pt2di(0,20));
        ELISE_COPY(mWEnter->all_pts(),P8COL::yellow,mWEnter->odisc());
        //mWEnter->move_to(Pt2di(100,20));
        mWEnter->lower();
    }

    ELISE_COPY(mWZ->all_pts(),P8COL::green,mWZ->odisc());
}
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();

}
Example #4
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();
   }
}