static Im2D_U_INT1 Im2(Im2D_U_INT1 Im1,Im2D_REAL4 XPar) { if (ImCox) return Im2D_U_INT1::FromFile("/home/pierrot/Data/Cox/pm-2.pgm"); Im2D_U_INT1 aRes(SzI.x,SzI.y); ELISE_COPY ( aRes.all_pts(), AUC( Im1.in_proj()[Virgule(FX+XPar.in(),FY)] * (0.9 + 0.2 *unif_noise_4(6)) + (unif_noise_4(2)-0.5)*20 ), aRes.out() ); return aRes; }
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(); }