Im2D_REAL4 Conv2Float(Im2DGen anI) { Pt2di aSz = anI.sz(); Im2D_REAL4 aRes(aSz.x,aSz.y); ELISE_COPY(anI.all_pts(),anI.in(),aRes.out()); return aRes; }
Im1D_REAL8 cIncEnsembleCamera::CurVals() { Im1D_REAL8 aRes(NbVal()); for (INT aK=0 ; aK<NbVal() ; aK++) aRes.data()[aK] = mAlloc.GetVar(aK); return aRes; }
ElRotation3D cNewO_OrInit2Im::SolOfAmbiguity(double aTeta) { ElMatrix<double> aMat = VectRotationArroundAxe(mDirAmbig,aTeta) * mBestSol.Mat(); Pt3dr aTr = CalcBaseOfRot(aMat,mBestSol.tr()); ElRotation3D aRes(aTr,aMat,true); return aRes; }
ElMatrix<REAL> cElHomographie::MatCoordHom() const { ElMatrix<REAL> aRes(3,3); mHX.SetCoHom(aRes.data()[0]); mHY.SetCoHom(aRes.data()[1]); mHZ.SetCoHom(aRes.data()[2]); return aRes; }
Polynome2dReal Polynome2dReal::FromVect(const std::vector<double>& aCoef,double anAmpl) { int aDeg = 0; while ( ((aDeg+2)*(aDeg+1))/2 < int(aCoef.size())) aDeg++; ELISE_ASSERT( ((aDeg+2)*(aDeg+1))/2 == int(aCoef.size()),"Polynome2dReal::FromVect"); Polynome2dReal aRes(aDeg,anAmpl); aRes.mCoeff = aCoef; return aRes; }
ElDistRadiale_PolynImpair SetToDeg(const ElDistRadiale_PolynImpair & aPol,INT aDeg) { ElDistRadiale_PolynImpair aRes(aPol.RMax(),aPol.Centre()); for (INT aK=0; aK<aDeg ; aK++) { aRes.PushCoeff(aPol.CoeffGen(aK)); } return aRes; }
Polynome2dReal Polynome2dReal::read(ELISE_fp & aFile) { std::vector<REAL> aCoeff = aFile.read(&aCoeff); REAL anAmpl = aFile.read(&anAmpl); INT aDmax = aFile.read(&aDmax); Polynome2dReal aRes(aDmax,anAmpl); for (int aK=0; aK<(INT)aCoeff.size() ; aK++) aRes.SetCoeff(aK,aCoeff[aK]); return aRes; }
Polynome2dReal Polynome2dReal::MapingChScale(REAL aChSacle) const { Polynome2dReal aRes(*this); aRes.mAmpl *= aChSacle; for (INT k=0 ; k<(INT)mCoeff.size() ; k++) { aRes.mMons[k].SetAmpl(aRes.mAmpl); aRes.mCoeff[k] *= aChSacle; } return aRes; }
cElPolygone cElPolygone::GenOp(const cElPolygone & aPol,INT anOp)const { gpc_polygon aGpcPol1 = ToGPC(); gpc_polygon aGpcPol2 = aPol.ToGPC(); gpc_polygon aGpcRes; gpc_polygon_clip (gpc_op(anOp),&aGpcPol1,&aGpcPol2,&aGpcRes); cElPolygone aRes(aGpcRes); GpcEl_Free(aGpcPol1); GpcEl_Free(aGpcPol2); gpc_free_polygon(&aGpcRes); return aRes; }
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; }
Im2D_U_INT1 Icone(const std::string & aName,const Pt2di & aSzCase,bool Floutage,bool Negatif) { cElBitmFont & aFont = cElBitmFont::BasicFont_10x8() ; Im2D_Bits<1> aImBin = aFont.MultiLineImageString(aName,Pt2di(0,5),-aSzCase,0); ELISE_COPY(aImBin.border(3),1,aImBin.out()); ELISE_COPY(aImBin.border(1),0,aImBin.out()); Pt2di aSz = aImBin.sz(); Im2D_U_INT1 aRes(aSz.x,aSz.y); if (Negatif) { ELISE_COPY(line(Pt2di(0,0),aSz),1,aImBin.oclip()); ELISE_COPY(line(Pt2di(aSz.x,0),Pt2di(0,aSz.y)),1,aImBin.oclip()); ELISE_COPY(aImBin.all_pts(),!aImBin.in(),aImBin.out()); } ELISE_COPY ( aRes.all_pts(), (!aImBin.in(0)) *255, aRes.out() ); if (Floutage) { ELISE_COPY ( aRes.all_pts(), ( Negatif ? Max(aRes.in(),rect_som(aRes.in(0),1)/9.0) : Min(aRes.in(),rect_som(aRes.in(0),1)/9.0) ), aRes.out() ); } return aRes; }
PolynomialEpipolaireCoordinate PolynomialEpipolaireCoordinate::read( ELISE_fp & aFile) { Pt2dr aP0 = aFile.read(&aP0); Pt2dr aDirX = aFile.read(&aDirX); Pt2dr aTrFin = aFile.read(&aTrFin); Polynome2dReal aPol = aFile.read(&aPol); REAL anAmpl = aFile.read(&anAmpl); INT aDeltaDegre = aFile.read(&aDeltaDegre); PolynomialEpipolaireCoordinate aRes(aP0,aDirX,aPol,anAmpl,aDeltaDegre); aRes.SetTrFinale(aTrFin); bool WithGrid = aFile.read((bool *)0); if (WithGrid) aRes.mGridCor = RImGrid::read(aFile); return aRes; }
template <class Type> Pt2d< Type> InvHom(Type a,Type b,Type c,Type d,Type e,Type f,Type g,Type h,Type U,Type V) { Type mA = a - U*g; Type mB = b - U*h; Type mC = d - V*g; Type mD = e - V*h; Type Delta = mA*mD - mB*mC; Type UP = U-c; Type VP = V-f; Pt2d<Type> aRes( ( mD*UP - mB*VP)/Delta, (-mC*UP + mA*VP) /Delta ); return aRes; }
Im2D_Bits<1> GetMasqSubResol(const std::string & aName,double aResol) { Tiff_Im aTF = Tiff_Im::BasicConvStd(aName); Pt2di aSzF = aTF.sz(); Pt2di aSzR = round_ni(Pt2dr(aSzF)/aResol); Im2D_Bits<1> aRes(aSzR.x,aSzR.y); Fonc_Num aFonc = aTF.in_bool_proj(); aFonc = StdFoncChScale(aFonc,Pt2dr(0,0),Pt2dr(aResol,aResol)); aFonc = aFonc > 0.75; ELISE_COPY (aRes.all_pts(), aFonc,aRes.out()); return aRes; }
static Im2D_REAL4 XParalaxe() { Im2D_REAL4 aRes(SzI.x,SzI.y); if (ImCox) return aRes; INT NbLab = 5; Fonc_Num FLab = Min(NbLab-1,Iconv(frandr() * NbLab)); for (INT k=0; k< 6 ; k++) FLab = label_maj(FLab,NbLab,Box2di(8)); ELISE_COPY ( aRes.all_pts(), (unif_noise_4(8) -0.5) * 18.0 + (FLab -(NbLab-1)/2.0) * 0, aRes.out() ); return aRes; }
ElMatrix<REAL> GlobMepRelCocentrique(double & anEcartMin,const ElPackHomologue & aPack, int aNbRansac,int aNbMaxPts) { aNbMaxPts = ElMin(aNbMaxPts,aPack.size()); std::vector<Pt3dr> aVDir1; std::vector<Pt3dr> aVDir2; cRandNParmiQ aRand(aNbMaxPts,aPack.size()); for (ElPackHomologue::tCstIter itH=aPack.begin() ; itH!=aPack.end() ; itH++) { if (aRand.GetNext()) { aVDir1.push_back(vunit(PZ1(itH->P1()))); aVDir2.push_back(vunit(PZ1(itH->P2()))); } } ElMatrix<REAL> aRes(3,3); anEcartMin = 1e60; while (aNbRansac) { int aKA = NRrandom3(aVDir1.size()); int aKB = NRrandom3(aVDir2.size()); if (aKA!=aKB) { aNbRansac--; ElMatrix<REAL> aMat = ComplemRotation(aVDir1[aKA],aVDir1[aKB],aVDir2[aKA],aVDir2[aKB]); double anEc = SomEcartDist(aMat,aVDir1,aVDir2); if (anEc<anEcartMin) { anEcartMin = anEc; aRes = aMat; } } } return aRes; }
cRawNuage cElNuage3DMaille::GetRaw() const { Pt2di aSz = SzUnique(); cRawNuage aRes(aSz); Pt2di aP0; for (aP0.x=0 ; aP0.x<aSz.x ; aP0.x++) { for (aP0.y=0 ; aP0.y<aSz.y ; aP0.y++) { if (IndexHasContenu(aP0)) { aRes.SetPt(aP0,PtOfIndex(aP0)); } else { aRes.SetPt(aP0,Pt3dr(0,0,0)); } } } return aRes; }
cSsBloc cIncIntervale::SsBlocComplet() { cSsBloc aRes(0,Sz()); aRes.BlocSetInt(*this); return aRes; }
std::vector<int> cAMD_Interf::DoRank(bool show) { Im2D_Bits<1> aM(1,1); if (show) aM = Im2D_Bits<1>(mNb,mNb,0); std::vector<int> Ap,Ai,P; Ap.push_back(0); for (int aK=0 ; aK<mNb ; aK++) { std::vector<int> & aVK = mV[aK]; std::sort(aVK.begin(),aVK.end()); aVK.erase(std::unique(aVK.begin(),aVK.end()),aVK.end()); for (int aI=0;aI<int(aVK.size()) ; aI++) { Ai.push_back(aVK[aI]); if (show) { aM.set(aK,aVK[aI],1); } // std::cout << " " << aVK[aI] ; } Ap.push_back(Ap.back()+aVK.size()); P.push_back(0); // std::cout << "\n"; } double Control [AMD_CONTROL] , Info [AMD_INFO] ; amd_defaults (Control) ; // amd_control (Control) ; int result; result = amd_order(mNb,VData(Ap),VData(Ai), VData(P),Control,Info); ELISE_ASSERT(result==0,"amd_order"); //std::cout << "RES = " << result << "\n"; std::vector<int> aRes(mNb,-1); for (int aK=0 ; aK<mNb ; aK++) { aRes[P[aK]] = aK; } if (show) { for (int aK=0 ; aK<mNb ; aK++) { } std::cout << "\n"; } // result = amd_order (n, Ap, Ai, P, Control, Info) ; if (show) { Im2D_Bits<1> aM2(mNb,mNb); for (int aX=0 ; aX<mNb ; aX++) { for (int aY=0 ; aY<mNb ; aY++) { aM2.set(aRes[aX],aRes[aY],aM.get(aX,aY)); // aM2.set(aX,aY,aM.get(P[aX],P[aY])); } } ShowMat(aM); std::cout << "\n"; ShowMat(aM2); } return aRes; }