void Scale_Im_Compr<TObj,TLut,TInd>::DoItZoom() { ElTimer aTimer; Zoom_Im_Compr<TObj,TLut,TInd> ZIC(this->_u2wX,this->_l0,_lut); for (INT wy0=this->_pW0.y; wy0<this->_pW1.y; ) { INT yU0 = round_ni(this->y_to_user(wy0)); INT wy1 = wy0+1; while ( (wy1<this->_pW1.y) && (yU0==round_ni(this->y_to_user(wy1)))) wy1++; yU0 = std::max(0,std::min(yU0,this->_SzU.y-1)); DeCompr ( _dim->lpckb(yU0), ZIC,this->_xU0,this->_xU1,_dim->per() ); mTimeUnCompr += aTimer.uval(); RasterUseLine ( Pt2di(this->_pW0.x,wy0), Pt2di(this->_pW1.x,wy1), this->_line ); aTimer.reinit(); wy0 = wy1; } }
void bug_10() { INT res; Im2D_U_INT1 b(300,300); cout << "should be : out of reading in integer mode\n"; copy(select(rectangle(Pt2di(-10,-13),Pt2di(103,105)),1),b.in(),sigma(res)); }
void bench_algo_dist_32() { bench_algo_dist_32(Pt2di(10,10)); bench_algo_dist_32(Pt2di(100,100)); bench_algo_dist_32(Pt2di(150,100)); bench_algo_dist_32(Pt2di(100,150)); }
Box2di cWindowXmlEditor::TopDraw() { ELISE_COPY(mW.all_pts(),mGrayFond,mW.ogray()); int aTx = mW.sz().x; // int aXMil = aTx/2; if (mFirstDraw) { mCaseQuit = cCaseX11Xml::Alloc(mW,Box2di(Pt2di(10,10),Pt2di(200,40)),P8COL::magenta); mCaseWarn = cCaseX11Xml::Alloc(mW,Box2di(Pt2di(10,2),Pt2di(aTx-2,48)),P8COL::red); mVCase.push_back(mCaseQuit); mVInfoCase.push_back(cWXXInfoCase(0,0)); } Box2di aRes = Draw(Pt2di(50,50),mTreeGlob,0,mFilterGlob); mFirstDraw = false; for (int aKC=0 ; aKC<int(mVCase.size()) ; aKC++) { cCaseX11Xml * aCX = mVCase[aKC]; aCX->Efface(); cWXXInfoCase & anIC = mVInfoCase[aKC]; cElXMLTree * aTree = anIC.mTree; if (aTree) aCX->string(-10,anIC.mTree->GetUniqueVal()); } ShowQuit(); return aRes; }
Box2di cWindowXmlEditor::PrintTag(Pt2di aP0,cElXMLTree * aTree,int aMode,int aLevel,cElXMLTree * aFilter) { if ((!mXmlMode) && (aMode!=0)) return Box2di(aP0-Pt2di(0,1),aP0-Pt2di(0,1)); std::string aTag = ((aMode == -1) ? "</" : "<") + aTree->ValTag() + ((aMode==0) ? "/>" : ">"); if (!mXmlMode) aTag = " " + aTree->ValTag() + " : "; Pt2di aSz = mW.SizeFixedString(aTag); Pt2di aP1 = aP0 + aSz; mW.fill_rect(Pt2dr(aP0)-Pt2dr(1,1),Pt2dr(aP1)+Pt2dr(1,1),mW.pgray()(mGrayTag)); if (aMode!=0) mW.draw_rect(Pt2dr(aP0)-Pt2dr(2,2),Pt2dr(aP1)+Pt2dr(2,2),Line_St(mW.pdisc()(P8COL::blue),2)); mW.fixed_string(Pt2dr(aP0)+Pt2dr(0,aSz.y), aTag.c_str(),mW.pdisc()(P8COL::black),false); Box2di aRes (aP0-mPRab,aP1+ mPRab); if ((aMode ==0) && mFirstDraw) { Pt2di aQ0 (aP0.x+aSz.x+5,aP0.y-4); Pt2di aQ1 (EndXOfLevel(aLevel)-5,aP0.y+aSz.y+4); mVCase.push_back(cCaseX11Xml::Alloc(mW,Box2di(aQ0,aQ1),P8COL::yellow)); mVInfoCase.push_back(cWXXInfoCase(aTree,aFilter)); } return aRes; }
void bench_im_reech() { bench_im_reech ( FX+FY, Pt2di(50,50), FX , FY , 4, epsilon ); bench_im_reech ( FX*3+FY*2+1, Pt2di(50,50), FX/2.0+FY/4.0 +3.0, FX/4.0+FY/2.0 +4.5, 4, epsilon ); bench_im_reech ( FX*3+FY*2+1, Pt2di(50,50), FX/2.1+FY/4.8 +8.1, FX/4.0+FY/2.0 +4.5, 9, 1/10.0 ); }
void TestKL() { Pt2di aSZ(200,200); Im2D_Bits<1> aImMasqF(aSZ.x,aSZ.y,1); Im2D_Bits<1> aImMasqDef(aSZ.x,aSZ.y,1); ELISE_COPY(rectangle(Pt2di(70,0),Pt2di(130,200)),0,aImMasqDef.out()); Im2D<U_INT2,INT> aImVal(aSZ.x,aSZ.y); ELISE_COPY(aImVal.all_pts(),FX,aImVal.out()); Video_Win aW=Video_Win::WStd(aSZ,3.0); ELISE_COPY(aW.all_pts(),aImVal.in(),aW.ogray()); ELISE_COPY(aW.all_pts(),aImMasqDef.in(),aW.odisc()); getchar(); aImVal = ImpaintL2(aImMasqDef,aImMasqF,aImVal); // NComplKLipsParLBas(aImMasqDef,aImMasqF,aImVal,1.0); ELISE_COPY(aW.all_pts(),aImVal.in(),aW.ogray()); Tiff_Im::Create8BFromFonc("toto.tif",aSZ,aImVal.in()); getchar(); }
void TestScroller::GUR_query_pointer(Clik cl,bool) { if (_mode_tr) { INT v = 1; if (cl.shifted()) v *= 2; if (cl.controled()) v *= 4; scrol.SetDTrW((_p0grab-Pt2di(cl._pt)) *v); //_p0grab = cl._pt; _p0grab = Pt2di( cl._pt ); // __NEW } else { REAL scy = _p0grab.y- cl._pt.y; scy /= -100.0; scy = _sc0grab *pow(2.0,scy); scy = std::min(std::max(scy,0.00),10.0); //scrol.SetScArroundPW(_p0grab,scy,true); scrol.SetScArroundPW( Pt2dr(_p0grab),scy,true); // __NEW } }
RImGrid::RImGrid ( bool AdaptStep, Pt2dr aP0, Pt2dr aP1, Pt2dr aStepGr, const std::string & aName, Pt2di aSz ) : mP0 (Inf(aP0,aP1)), mP1 (Sup(aP0,aP1)), mStepGr (AdaptStep ? AdaptPas(aStepGr,mP1-mP0) : aStepGr), mSzGrid ( (aSz!=Pt2di(0,0)) ? aSz : ( AdaptStep ? (round_ni((aP1-aP0).dcbyc(mStepGr))+Pt2di(1,1)) : (round_up((aP1-aP0).dcbyc(mStepGr))+Pt2di(1,1)) ) ), mDef (-1e20), mGrid (mSzGrid.x,mSzGrid.y,mDef), mTim (new TIm2D<REAL,REAL>(mGrid)), mName (aName), mStepAdapted (AdaptStep) { }
Fonc_Num_Computed * compute(const Arg_Fonc_Num_Comp & arg) { if (arg.flux()->is_line_map_rect()) return _f.compute(arg); Box2di b(Pt2di(0,0),Pt2di(0,0));; Tjs_El_User.ElAssert ( arg.flux()->is_rect_2d(b), EEM0 << "incompatible flux for function : \"" << _name << "\"\n" << "| (it is a \"linear operator\"," << "it requires a flux pts of kind\n" << "| \"rectangle \" or \"line_map_rect\")\n" ); Flux_Pts_Computed * flxi = RLE_Flux_Pts_Computed::rect_2d_interface ( b._p0,b._p1,b._p1.x-b._p0.x ); Fonc_Num_Computed * fc = _f.compute(Arg_Fonc_Num_Comp(flxi)); if (fc->integral()) return new Linear_Gen_Comp<INT>(arg,b,flxi,fc); else return new Linear_Gen_Comp<REAL>(arg,b,flxi,fc); }
void BiScroller::LoadXImage(Pt2di p0W,Pt2di p1W,bool quick) { mScrGray->SetSameGeom(*this); if (mScrCol) mScrCol->SetGeomTranslated(*this,mTr); if (quick) { TheFirstScrAct().LoadXImageInVisu(mVideoVisu,p0W,p1W,quick); return; } if (Im1Act()) Scr1().LoadXImageInVisu(mMemGray,p0W,p1W,false); if (Im2Act()) Scr2().LoadXImageInVisu(mMemCol,p0W,p1W,false); for (INT y=p0W.y; y<p1W.y ; y++) { MakeOneLine ( mDataImR,mDataImG,mDataImB, y,p0W.x,p1W.x, mDataGray[y],mDataCol[y] ); mVideoVisu.XIm_write_image_brute ( Pt2di(p0W.x,0),Pt2di(p0W.x,y),Pt2di(p1W.x-p0W.x,1), mImR, mImG, mImB ); } }
void bug_11() { Fonc_Num f; INT res; cout << "should be : Fonc_Num non initialized\n"; copy(rectangle(Pt2di(-10,-13),Pt2di(103,105)),f,sigma(res)); }
ElList<Pt2di> lpts_square_L1(INT nb) { return NewLPt2di(Pt2di( nb, 0)) + Pt2di( 0, nb) + Pt2di(-nb, 0) + Pt2di( 0,-nb); }
void bug_5() { INT res; Im2D_U_INT1 b(300,300); cout << "should be : out of reading rle \n"; copy(rectangle(Pt2di(-10,-13),Pt2di(103,105)),b.in(),sigma(res)); }
TestScroller::TestScroller ( Video_Win WIN, ElImScroller & SCROL ) : W (WIN), scrol (SCROL) { scrol.set(Pt2dr(2000,2000),1); /* scrol.SetDTrW(Pt2di(323,300)); for (INT k=0; k<10000; k++) { cout << k << "\n"; scrol.SetDTrW(Pt2di(1,1)); } */ while (true) { Clik cl1 = W.disp().clik_press(); // cout << "But " << cl1._b << "\n"; switch (cl1._b ) { case 2 : scrol.SetDTrW(Pt2di(-10,0)); break; case 1 : _mode_tr = FIVE_BOUT || (! cl1.shifted()); //_p0grab = cl1._pt; _p0grab = Pt2di(cl1._pt); // __NEW _sc0grab = scrol.sc(); if (_sc_evt) //scrol.SetScArroundPW(_p0grab,scrol.sc(),false); scrol.SetScArroundPW( Pt2dr(_p0grab),scrol.sc(),false); // __NEW W.grab(*this); _sc_evt = false; break; case 4 : SetScale(true); _sc_evt = true; break; case 5 : SetScale(false); _sc_evt = true; break; case 3 : return; } } }
void CorrectRect(Pt2di & aP0,Pt2di & aP1,const Pt2di & aSz) { aP0 = Inf(aSz,Sup(aP0,Pt2di(0,0))); aP1 = Inf(aSz,Sup(aP1,Pt2di(0,0))); CorrectNonEmpty(aP0.x,aP1.x,aSz.x); CorrectNonEmpty(aP0.y,aP1.y,aSz.y); }
ElList<Pt2di> lpts_square_Linf(INT nb) { nb /= 2; return NewLPt2di(Pt2di( nb, nb)) + Pt2di(-nb, nb) + Pt2di(-nb,-nb) + Pt2di( nb,-nb); }
Skel_OPB_Comp::~Skel_OPB_Comp() { if (_skel) { DELETE_TAB_MATRICE(_skel,dim_in(),Pt2di(0,0),_sz); DELETE_MATRICE(_im_init,Pt2di(0,0),_sz); } }
GenScaleIm<TObj>::~GenScaleIm() { DELETE_VECTOR(_u2wX ,-RAB); DELETE_VECTOR(_u2wY ,-RAB); DELETE_VECTOR(_Cw2uX ,-RAB); DELETE_VECTOR(_Cw2uY ,-RAB); DELETE_MATRICE(_line,Pt2di(-RAB,0),Pt2di(std::max(_SzW.x,_SzU.x)+RAB,_nb_chan)); }
bool Approx_poly::freem_supprimable(INT ind) { if (ind <= 1) return false; INT k0 = freeman_code(Pt2di(_s[ind-1]._pt-_s[ind]._pt)); if (k0<0) return false; INT k1 = freeman_code(Pt2di(_s[ind]._pt-_s[ind+1]._pt)); if (k1<0) return false; return k1==k0; }
PS_Window Data_Mat_PS_Window::kthw(INT x,INT y) { Tjs_El_User.ElAssert ( Pt2di(x,y).in_box(Pt2di(0,0),_nb), EEM0 << "invalid request for windows of PS MAT WINDOW" ); return _w[y][x]; }
void bench_Box2di() { for (INT k=0; k< 500 ; k++) { bench_Box2di::Suppr(Pt2di(5,5)); bench_Box2di::Suppr(Pt2di(10,10)); bench_Box2di::Suppr(Pt2di(20,20)); bench_Box2di::Suppr(Pt2di(50,50)); } }
void ElImplemDequantifier::DoDequantif(Pt2di aSzIm,Fonc_Num f2Deq,bool aVerifI) { SetSize(aSzIm); SetChamfer(Chamfer::d32); Symb_FNum aFC = Max(trans(Rconv(f2Deq),Pt2di(-1,-1)),eValOut+2); Symb_FNum aIFC = round_ni(aFC); double aDifI; ELISE_COPY ( mImQuant.interior(1), Virgule(aIFC,Abs(aFC-aIFC)), // Max(trans(f2Deq,Pt2di(-1,-1)),eValOut+2), Virgule(mImQuant.out(),VMax(aDifI)) ); if (aVerifI) { ELISE_ASSERT(aDifI<1e-6,"Non int in ElImplemDequantifier::DoDequantif"); } ELISE_COPY(mImQuant.border(1),eValOut, mImQuant.out()); QuickSetDist(1); Symb_FNum sM (mDistMoins.in()); Symb_FNum sP (mDistPlus.in()); /* Pt2di P128(1565+2,1100+2); Pt2di P126(1475+2,1085+2); std::cout << "P128 : " << int(mDistMoins.data()[P128.y][P128.x]) << " " << int(mDistPlus.data()[P128.y][P128.x]) << "\n" ; std::cout << "P126 : " << int(mDistMoins.data()[P126.y][P126.x]) << " " << int(mDistPlus.data()[P126.y][P126.x]) << "\n" ; std::cout << "SZ IM " << aSzIm << "\n"; getchar(); */ ELISE_COPY ( mImDeq.all_pts(), trans(mImQuant.in()+(sM/Rconv(sM+sP)-0.5),Pt2di(1,1)), mImDeq.out() ); }
void bench_op_buf_cat() { for (INT k=0 ; k< 100; k++) { bench_op_buf_cat(Pt2di(100,100)); bench_op_buf_cat(Pt2di(150,100)); bench_op_buf_cat(Pt2di(150,150)); cout << "K= " << k << "\n"; } }
void bench_fft_correl() { for (INT k=0 ; k<10 ; k++) { bench_qcorrel(Pt2di(4,4)); bench_qcorrel(Pt2di(8,4)); bench_qcorrel(Pt2di(4,8)); bench_qcorrel(Pt2di(8,16)); bench_qcorrel(Pt2di(16,8)); } }
void EpipolaireCoordinate::SetGridCorrec ( Fonc_Num DeltaY, Fonc_Num Pond, REAL aStepGr, Box2dr aBoxIm, REAL aRatioMin ) { Box2dr aBoxEpi = ImageOfBox(aBoxIm); // delete mGridCor; RImGrid * aGridCor = new RImGrid ( false, aBoxEpi._p0-Pt2dr(2,2), aBoxEpi._p1+Pt2dr(2,2), Pt2dr(aStepGr,aStepGr) ); for (INT x=0 ; x<aGridCor->SzGrid().x; x++) for (INT y=0 ; y<aGridCor->SzGrid().y; y++) { ElList<Pt2di> aLC; for (INT k=0 ; k<4 ; k++) { Pt2dr aP = Inverse(aGridCor->ToReal(Pt2dr(x,y)+TAB_CornerPix[k])); aLC = aLC+Pt2di(aP); } Symb_FNum aSP(Rconv(Pond!=0)); REAL Sy,Sp,SNb; ELISE_COPY ( polygone(aLC), Virgule(DeltaY*aSP,aSP,1.0), Virgule(sigma(Sy),sigma(Sp),sigma(SNb)) ); if (Sp > SNb * aRatioMin) { // cout << " In " << Sy/Sp << " \n"; aGridCor->SetValueGrid(Pt2di(x,y),Sy/Sp); } else { // cout << "------------ Out \n"; } } aGridCor->ExtDef(); mGridCor = aGridCor; }
template <class Type,class TypeB> void bench_r2d_assoc ( const OperAssocMixte & op, Type *, TypeB *, Pt2di sz, INT x0, INT x1 ) { Im2D<Type,TypeB> I(sz.x,sz.y,(Type)0); Im2D_REAL8 R1(sz.x,sz.y,0.0); Im2D_REAL8 R2(sz.x,sz.y,0.0); Im2D_REAL8 R3(sz.x,sz.y,0.0); ELISE_COPY(I.all_pts(),255*frandr(),I.out()); ELISE_COPY ( I.all_pts(), linear_red(op,I.in(),x0,x1), R1.out() ); TypeB vdef; op.set_neutre(vdef); ELISE_COPY ( I.all_pts(), rect_red(op,I.in(vdef),Box2di(Pt2di(x0,0),Pt2di(x1,0))), R2.out() ); ELISE_COPY ( I.lmr_all_pts(Pt2di(1,0)), linear_red(op,I.in(),x0,x1), R3.out() ); REAL d12,d23; ELISE_COPY ( R1.all_pts(), Virgule( Abs(R1.in()-R2.in()), Abs(R2.in()-R3.in()) ), Virgule(VMax(d12),VMax(d23)) ); BENCH_ASSERT((d12<epsilon)&&(d23<epsilon)); }
void cWindowXmlEditor::ShowWarn(const std::string& aMes1, const std::string& aMes2) { mCaseWarn->Efface(P8COL::red); mW.fixed_string_middle(Box2di(Pt2di(0,5),Pt2di(mW.sz().x,20)),0,aMes1,mW.pdisc()(P8COL::black),true); mW.fixed_string_middle(Box2di(Pt2di(0,25),Pt2di(mW.sz().x,40)),0,aMes2,mW.pdisc()(P8COL::black),true); mCaseWarn->clik_in(); mCaseWarn->Efface(mW.pgray()(mGrayFond)); ShowQuit(); }
void cDistorBilin::V_SetScalingTranslate(const double & aF,const Pt2dr & aPP) { for (int aKY=0 ; aKY<= mNb.y ; aKY++) { for (int aKX=0 ; aKX<= mNb.x ; aKX++) { Dist(Pt2di(aKX,aKY)) = ( Dist(Pt2di(aKX,aKY))- aPP) / aF; } } mP0 = (mP0-aPP) / aF; mP1 = (mP1-aPP) / aF; mStep = mStep / aF; }
void bug_14() { cout << "should be : Symb_FNum is used in a context different from ... \n"; Symb_FNum xpy (FX>FY); INT s; copy ( select(rectangle(Pt2di(-10,-13),Pt2di(103,105)), !(xpy)), xpy, sigma(s) ); }