Example #1
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()
   );
}
Example #2
0
void ElImplemDequantifier::Test()
{
    INT Z=2;

    Pt2di aSZ = mSzReel - Pt2di(2,2);

    Video_Win aW = Video_Win::WStd(aSZ,Z);
    aW.set_title("Image Quant");
    Video_Win aW2 = Video_Win::WStd(aSZ,Z);
    Video_Win aW3 = Video_Win::WStd(aSZ,Z);
    Video_Win aW4 = Video_Win::WStd(aSZ,Z);
    aW2.set_title("Deq");
    aW3.set_title("Deq+Cuv");
    aW4.set_title("FRELLE");


    Fonc_Num aFR = sin(FX/20.0) * sin(FY/20.0) * 3 +  FX/70.0;

// aFR = 5 * (1- (Square(FX-aSZ.x/2)+Square(FY-aSZ.y/2))/square_euclid(aSZ/2));

    Fonc_Num aFonc = round_ni (aFR);
                    

     Fonc_Num aBase = 0;// aFonc;


    REAL Ampl = 90.0;
    ELISE_COPY(aW.all_pts(),(aFonc -aBase)*Ampl,aW.ocirc());

    DoDequantif(aSZ,aFonc,true);



    ELISE_COPY ( aW2.all_pts(), (ImDeqReelle()-aBase)*Ampl, aW2.ocirc());
    
    SetTraitSpecialCuv(true);
    DoDequantif(aSZ,aFonc,true);
    ELISE_COPY ( aW3.all_pts(), (ImDeqReelle()-aBase)*Ampl, aW3.ocirc());
    ELISE_COPY ( aW4.all_pts(), (aFR-aBase)*Ampl, aW4.ocirc());

/*
    Video_Win aW4 = Video_Win::WStd(aSZ,Z);
    ELISE_COPY 
    ( 
          aW3.all_pts(), 
          Moy(Moy( aF.in(0),3),3) *Ampl,
          aW3.ocirc()
    );
    ELISE_COPY 
    ( 
          aW3.all_pts(), 
          Moy(Moy( ImDeqReelle(),3),3) *Ampl,
          aW4.ocirc()
    );

*/


    while(1) getchar();
}
Example #3
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));
}
Example #4
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);
}
Example #5
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 #7
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());
}
Example #8
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);
}