本文整理汇总了C++中Tiff_Im::out方法的典型用法代码示例。如果您正苦于以下问题:C++ Tiff_Im::out方法的具体用法?C++ Tiff_Im::out怎么用?C++ Tiff_Im::out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiff_Im
的用法示例。
在下文中一共展示了Tiff_Im::out方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeFCol
void MakeFCol()
{
Tiff_Im Tif("../TMP/f3Reduc4.tif");
Tiff_Im NewTif
(
"../TMP/Col.tif",
Tif.sz(),
GenIm::u_int1,
Tiff_Im::No_Compr,
Tiff_Im::RGB,
ElList<Arg_Tiff> ()
+ Arg_Tiff(Tiff_Im::ATiles(Pt2di(1024,1024)))
+ Arg_Tiff(Tiff_Im::APlanConf(Tiff_Im::Chunky_conf))
);
ELISE_COPY
(
Tif.all_pts(),
its_to_rgb
(Virgule(
Tif.in(0),
FX,
Abs((FY%512)-256)
)),
NewTif.out()
);
}
示例2: CalculShadeByDiff
void cImage_LumRas::CalculShadeByDiff()
{
mImShade.Resize(mAppli.mImGr.sz());
std::string aNameOut = mDir+ "LumRas_"+StdPrefix(mName) + ".tif";
Tiff_Im TifTest
(
aNameOut.c_str(),
mIm.sz(),
// GenIm::u_int1,
GenIm::real4,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero
);
Fonc_Num aFRas = FLoc(6,50,mIm);
Fonc_Num aFStd = FLoc(6,50,mAppli.mImGr);
Tiff_Im::Create8BFromFonc("Test-Ras.tif",mIm.sz(),aFRas*100);
Tiff_Im::Create8BFromFonc("Test-Std.tif",mIm.sz(),aFStd*100);
// Fonc_Num cImage_LumRas::FLoc(int aNbIter,int aSzW,Fonc_Num aF)
ELISE_COPY(mImShade.all_pts(),(aFRas-aFStd),mImShade.out());
ELISE_COPY
(
TifTest.all_pts(),
// Max(0,Min(255,128 * (1 + 2*mImShade.in()))),
mImShade.in(),
TifTest.out()
);
}
示例3: Write_Vignette
void Write_Vignette(string aDir, string aNameOut,vector<double> aParam,string aDirOut, Pt2di aSz){
//Bulding the output file system
ELISE_fp::MkDirRec(aDir + aDirOut);
//Reading the image and creating the objects to be manipulated
aNameOut=aDir + aDirOut + aNameOut;
Tiff_Im aTF=Tiff_Im(aNameOut.c_str(), aSz, GenIm::real4, Tiff_Im::No_Compr, Tiff_Im::BlackIsZero);
Im2D_REAL4 aIm(aSz.x,aSz.y);
ELISE_COPY
(
aTF.all_pts(),
aTF.in(),
aIm.out()
);
REAL4 ** aData = aIm.data();
for (int aY=0 ; aY<aSz.y ; aY++)
{
for (int aX=0 ; aX<aSz.x ; aX++)
{
double x0=aSz.x/2;
double y0=aSz.y/2;
double D=pow(aX-x0,2)+pow(aY-y0,2);
double aCor=1+aParam[0]*D+aParam[1]*pow(D,2)+aParam[2]*pow(D,3);
if(aCor<1){aData[aY][aX]=1;}else{aData[aY][aX]=aCor;}
}
}
Tiff_Im aTOut
(
aNameOut.c_str(),
aSz,
GenIm::real4,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero
);
ELISE_COPY
(
aTOut.all_pts(),
aIm.in(),
aTOut.out()
);
}
示例4: Opt
void GMCube::Opt()
{
REAL aCapaTot = 0;
ElTimer aTimer;
INT aCPT = 0;
{
// if ((aCPT %10==0) || (aCPT>=155)) pSCA->NbChem();
INT aCapa = pSCA->PccMaxFlow();
aCapaTot += aCapa;
aCPT++;
if ((aCPT%1 == 0) || (aCapa == 0))
cout << "CPT " << aCPT
<< " Time : " << aTimer.uval()
<< " DCapa : " << aCapa
<< " Som Capa = " << aCapaTot << "\n";
{
cout << "AAAAAAAAAAA\n";
Im2D_INT2 aZ = pSCA->Sol(0);
Tiff_Im aTif
(
"/home/pierrot/Data/Cox.tif",
mSz,
GenIm::u_int1,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero
);
ELISE_COPY(aZ.all_pts(),aZ.in(),aTif.out());
ShowIm2(aZ,mW4);
cout << "BBBBBBBB\n";
return;
}
}
}
示例5:
template <class Type> void Bench_PackB_IM<Type>::TiffVerif()
{
Pt2di SzDalle = Pt2di(mPer,64);
Tiff_Im aTifFile
(
ELISE_BFI_DATA_DIR "ex.tif",
sz,
type_of_ptr((Type *)0),
Tiff_Im::NoByte_PackBits_Compr,
Tiff_Im::BlackIsZero,
L_Arg_Opt_Tiff()
+ Arg_Tiff(Tiff_Im::ATiles(SzDalle))
);
ELISE_COPY(aTifFile.all_pts(),pck.in(),aTifFile.out());
INT VDIF;
ELISE_COPY(aTifFile.all_pts(),Abs(pck.in()-aTifFile.in()),VMax(VDIF));
BENCH_ASSERT(VDIF==0);
if (type_of_ptr((Type *)0)==GenIm::u_int1)
{
PackB_IM<U_INT1> aPack2 = aTifFile.un_load_pack_bit_U_INT1();
ELISE_COPY(aTifFile.all_pts(),Abs(pck.in()-aPack2.in()),VMax(VDIF));
BENCH_ASSERT(VDIF==0);
}
if (type_of_ptr((Type *)0)==GenIm::u_int2)
{
PackB_IM<U_INT2> aPack2 = aTifFile.un_load_pack_bit_U_INT2();
ELISE_COPY(aTifFile.all_pts(),Abs(pck.in()-aPack2.in()),VMax(VDIF));
BENCH_ASSERT(VDIF==0);
}
}
示例6: Vignette_correct
void Vignette_correct(string aDir, GrpVodka aGrpVodka,string aDirOut, string InCal){
//Bulding the output file system
ELISE_fp::MkDirRec(aDir + aDirOut);
//Reading vignette files
char foc[5],dia[4];
sprintf(foc, "%04d", int(10*aGrpVodka.foc));
sprintf(dia, "%03d", int(10*aGrpVodka.diaph));
string aNameVignette="Foc" + (string)foc + "Diaph" + (string)dia + "-FlatField.tif";
//string aNameVignette = "Foc"+ ToString(round_ni(aGrpVodka.foc)) + "Diaph" + ToString(round_ni(10*aGrpVodka.diaph)) + "-FlatField.tif";
Tiff_Im aTFV= Tiff_Im::StdConvGen(aDir + InCal + aNameVignette,1,false);
Pt2di aSz = aTFV.sz();
Im2D_REAL4 aVignette(aSz.x,aSz.y);
ELISE_COPY
(
aTFV.all_pts(),
aTFV.in(),
aVignette.out()
);
REAL4 ** aDataVignette = aVignette.data();
//Correcting images
int nbIm=aGrpVodka.size();
#ifdef USE_OPEN_MP
#pragma omp parallel for
#endif
for(int i=0;i<nbIm;i++)
{
string aNameIm=aGrpVodka.aListIm[i];
cout<<"Correcting "<<aNameIm<<endl;
string aNameOut=aDir + aDirOut + aNameIm +"_vodka.tif";
//Reading the image and creating the objects to be manipulated
Tiff_Im aTF= Tiff_Im::StdConvGen(aDir + aNameIm,3,false);
Pt2di aSz = aTF.sz();
Im2D_U_INT1 aImR(aSz.x,aSz.y);
Im2D_U_INT1 aImG(aSz.x,aSz.y);
Im2D_U_INT1 aImB(aSz.x,aSz.y);
ELISE_COPY
(
aTF.all_pts(),
aTF.in(),
Virgule(aImR.out(),aImG.out(),aImB.out())
);
U_INT1 ** aDataR = aImR.data();
U_INT1 ** aDataG = aImG.data();
U_INT1 ** aDataB = aImB.data();
for (int aY=0 ; aY<aSz.y ; aY++)
{
for (int aX=0 ; aX<aSz.x ; aX++)
{
double aCor=aDataVignette[aY][aX];
double R = aDataR[aY][aX] * aCor;
double G = aDataG[aY][aX] * aCor;
double B = aDataB[aY][aX] * aCor;
if(R>255){aDataR[aY][aX]=255;}else if(aCor<1){continue;}else{aDataR[aY][aX]=R;}
if(G>255){aDataG[aY][aX]=255;}else if(aCor<1){continue;}else{aDataG[aY][aX]=G;}
if(B>255){aDataB[aY][aX]=255;}else if(aCor<1){continue;}else{aDataB[aY][aX]=B;}
}
}
Tiff_Im aTOut
(
aNameOut.c_str(),
aSz,
GenIm::u_int1,
Tiff_Im::No_Compr,
Tiff_Im::RGB
);
ELISE_COPY
(
aTOut.all_pts(),
Virgule(aImR.in(),aImG.in(),aImB.in()),
aTOut.out()
);
}
}
示例7: mImResidu
//.........这里部分代码省略.........
mNewOri2.SetOrientation(mCamF2->RF().CurRot());
Pt3dr aPMoy = CalcPtMoy(mNewOri1,mNewOri2);
mNewOri1.SetAltiSol(aPMoy.z);
mNewOri2.SetAltiSol(aPMoy.z);
std::string aNAu = aModele.Modele().AutomSelExportOri().Val();
std::string aNEx1 = aModele.Modele().AutomNamesExportOri1().Val();
std::string aNEx2 = aModele.Modele().AutomNamesExportOri2().Val();
std::string aNI1 = mAppli.PDV1()->Name();
std::string aNI2 = mAppli.PDV2()->Name();
std::string aNOri1 = mAppli.FullDirGeom()
+ StdNameFromCple(aModele.AutomExport(),aNAu,aNEx1,"@",aNI1,aNI2);
std::string aNOri2 = mAppli.FullDirGeom()
+ StdNameFromCple(aModele.AutomExport(),aNAu,aNEx2,"@",aNI1,aNI2);
bool aXmlRes = false;
if (StdPostfix(aNOri1)== "xml")
{
aXmlRes = true;
ELISE_ASSERT
(
(StdPostfix(aNOri2)=="xml")
&& (mOC1!=0) && (mOC2!=0),
"Incoherence in XML export for cMA_AffineOrient"
);
// Les points de verifs, si ils existent n'ont pas de raison d'etre transposables
mOC1->Verif().SetNoInit();
mOC2->Verif().SetNoInit();
ElRotation3D aR1 = mCamF1->RF().CurRot();
ElRotation3D aR2 = mCamF2->RF().CurRot();
mOC2->Externe() = From_Std_RAff_C2M(aR2,mOC2->Externe().ParamRotation().CodageMatr().IsInit());
mOC1->Externe().AltiSol().SetVal(aPMoy.z);
mOC2->Externe().AltiSol().SetVal(aPMoy.z);
mOC1->Externe().Profondeur().SetVal(ProfFromCam(aR1.inv(),aPMoy));
mOC2->Externe().Profondeur().SetVal(ProfFromCam(aR2.inv(),aPMoy));
}
TestOri1Ori2(true,*mOri1,*mOri2);
TestOri1Ori2(true,mNewOri1,mNewOri2);
std::cout << "ZMoyen = " << aPMoy.z << "\n";
Fonc_Num aFoK = (mImPds.in()>0);
Fonc_Num aFRes = Max(0,Min(255,128.0 +mImResidu.in()*20));
ELISE_COPY
(
aFileResidu.all_pts(),
aFoK*its_to_rgb(Virgule(aFRes,3.14,32*Abs(mImResidu.in()>0.5)))
+ (1-aFoK)*Virgule(255,0,0),
aFileResidu.out()
);
bool Exp1 = aModele.Modele().AutomNamesExportOri1().IsInit();
bool Exp2 = aModele.Modele().AutomNamesExportOri2().IsInit();
ELISE_ASSERT(Exp1 == Exp2,"Incoherence in AutomNamesExportOri");
if (Exp1)
{
std::cout << "EXPORT OOOOOOOOOOOOOOORI\n";
AssertAutomSelExportOriIsInit(aModele.Modele());
if(aXmlRes)
{
MakeFileXML(*mOC1,aNOri1,"MicMacForAPERO");
MakeFileXML(*mOC2,aNOri2,"MicMacForAPERO");
}
else
{
ELISE_ASSERT(false,"Cannot write ori ");
// OO mNewOri1.write_txt(aNOri1.c_str());
// OO mNewOri2.write_txt(aNOri2.c_str());
}
}
if (aModele.Modele().SigmaPixPdsExport().ValWithDef(-1) > 0)
{
double aPds = aModele.Modele().SigmaPixPdsExport().Val();
for
(
ElPackHomologue::iterator iT = mPack.begin();
iT != mPack.end();
iT++
)
{
Pt2dr aQ1 = mCam1.F2toPtDirRayonL3(iT->P1());
Pt2dr aQ2 = mCam2.F2toPtDirRayonL3(iT->P2());
double aL = ElAbs(mCpl12->ResiduSigneP1P2(aQ1,aQ2))*mFocale;
double aP = ElSquare(aPds)/(ElSquare(aPds)+ElSquare(aL));
iT->Pds() *= aP;
}
}
}
示例8: MakeExport
//.........这里部分代码省略.........
switch (mModele.TypeModele())
{
case eTMA_Homologues :
SauvHomologues(pMatr->PackHomInit());
break;
case eTMA_DHomD :
// std::cout << "PKS = " << aPackIn->size() << "\n"; getchar();
SolveHomographie(*aPackIn);
SauvHomologues(pMatr->PackHomInit());
break;
case eTMA_Ori :
{
if ((aTol<1e10) || (aFiltre !=0))
{
GotOut = FiltragePointHomologues(pMatr->PackHomInit(),aNewPack,aTol,aFiltre);
aPackIn = & aNewPack;
}
SauvHomologues(pMatr->PackHomInit());
if (mModele.AffineOrient().Val())
{
cMA_AffineOrient aMAAO
(
mAppli,
*this,
mGeoTer,
mModele.L1CalcOri().Val(),
pMatr->Sz(),
*aPackIn
);
// SauvHomologues(*aPackIn);
if (mModele.MakeImagePxRef().Val())
{
aMAAO.MakeImagePxRef();
}
}
}
break;
case eTMA_Nuage3D :
{
std::string aNameRes = std::string("Nuage3D")
+ mAppli.NameChantier()
+ std::string(".tif");
if (mModele.KeyNuage3D().IsInit())
{
aNameRes = mAppli.ICNM()->Assoc1To1
(
mModele.KeyNuage3D().Val(),
mAppli.NameChantier(),
true
);
}
aNameRes = mAppli.FullDirResult() + aNameRes;
Tiff_Im aFile
(
aNameRes.c_str(),
pMatr->ImAppX().sz(),
GenIm::real4,
Tiff_Im::No_Compr,
Tiff_Im::PtDAppuisDense
);
ELISE_COPY
(
aFile.all_pts(),
Virgule
(
pMatr->ImPds().in(),
pMatr->ImAppX().in(),
pMatr->ImAppY().in(),
pMatr->ImAppZ().in()
),
aFile.out()
);
}
break;
default :
ELISE_ASSERT(false,"TypeModeleAnalytique Non Traite");
break;
}
delete pMatr;
if (GotOut)
{
mAppli.MicMacErreur
(
eErrPtHomHorsImage,
"Point Homologue Hors Image",
"Specification Utilisateur sur la Tolerance : <TolerancePointHomInImage>"
);
}
}
示例9: RotateImage
void RotateImage(double alpha, Pt2di aSzOut, vector<Pt2dr> Pts , string aNameDir, string aNameIm)
{
cout<<"Rotating "<<aNameIm<<endl;
string aNameOut=aNameDir + "Croped_images/" + aNameIm + ".tif";
//Reading the image and creating the objects to be manipulated
Tiff_Im aTF= Tiff_Im::StdConvGen(aNameDir + aNameIm,1,false);
Pt2di aSz = aTF.sz();
Pt2dr P1Cor=Rot2D(alpha, Pts[0], Pts[1]); //P1Cor.x=cos(alpha)*(Pts[0].x-Pts[1].x)+sin(alpha)*(Pts[0].y-Pts[1].y)+Pts[1].x; P1Cor.y=-sin(alpha)*(Pts[0].x-Pts[1].x)+cos(alpha)*(Pts[0].y-Pts[1].y)+Pts[1].y;
Pt2dr P3Cor=Rot2D(alpha, Pts[2], Pts[1]); //P3Cor.x=cos(alpha)*(Pts[2].x-Pts[1].x)+sin(alpha)*(Pts[2].y-Pts[1].y)+Pts[1].x; P3Cor.y=-sin(alpha)*(Pts[2].x-Pts[1].x)+cos(alpha)*(Pts[2].y-Pts[1].y)+Pts[1].y;
Im2D_U_INT1 aImR(aSz.x,aSz.y);
//Im2D_U_INT1 aImG(aSz.x,aSz.y);
//Im2D_U_INT1 aImB(aSz.x,aSz.y);
Im2D_U_INT1 aImROut(aSzOut.x,aSzOut.y);
Im2D_U_INT1 aImGOut(aSzOut.x,aSzOut.y);
Im2D_U_INT1 aImBOut(aSzOut.x,aSzOut.y);
ELISE_COPY
(
aTF.all_pts(),
aTF.in(),
aImR.out()//Virgule(aImR.out(),aImG.out(),aImB.out())
);
U_INT1 ** aDataR = aImR.data();
//U_INT1 ** aDataG = aImG.data();
//U_INT1 ** aDataB = aImB.data();
U_INT1 ** aDataROut = aImROut.data();
U_INT1 ** aDataGOut = aImGOut.data();
U_INT1 ** aDataBOut = aImBOut.data();
//Parcours des points de l'image de sortie et remplissage des valeurs
Pt2dr ptOut;
Pt2di imageTopCorner, imageBottomCorner;
imageTopCorner.x = (int)(P1Cor.x + 0.5) + (int)(max(abs(P1Cor.x - Pts[1].x), abs(P1Cor.x - P3Cor.x)) - aSzOut.x) / 2;
imageTopCorner.y = (int)(P1Cor.y + 0.5) + (int)(max(abs(P3Cor.y - Pts[1].y), abs(P1Cor.y - P3Cor.y)) - aSzOut.y) / 2;
imageBottomCorner.x = imageTopCorner.x + aSzOut.x;
imageBottomCorner.y = imageTopCorner.y + aSzOut.y;
for (int aY=imageTopCorner.y ; aY<imageBottomCorner.y ; aY++)
{
for (int aX=imageTopCorner.x ; aX<imageBottomCorner.x ; aX++)
{
ptOut.x=cos(-alpha)*(aX-Pts[1].x)+sin(-alpha)*(aY-Pts[1].y)+Pts[1].x;
ptOut.y=-sin(-alpha)*(aX-Pts[1].x)+cos(-alpha)*(aY-Pts[1].y)+Pts[1].y;
aDataROut[aY-imageTopCorner.y][aX-imageTopCorner.x] = Reechantillonnage::biline(aDataR, aSz.x, aSz.y, ptOut);
aDataGOut[aY-imageTopCorner.y][aX-imageTopCorner.x] = Reechantillonnage::biline(aDataR, aSz.x, aSz.y, ptOut);
aDataBOut[aY-imageTopCorner.y][aX-imageTopCorner.x] = Reechantillonnage::biline(aDataR, aSz.x, aSz.y, ptOut);
}
}
Tiff_Im aTOut
(
aNameOut.c_str(),
aSzOut,
GenIm::u_int1,
Tiff_Im::No_Compr,
Tiff_Im::RGB
);
ELISE_COPY
(
aTOut.all_pts(),
Virgule(aImROut.in(),aImGOut.in(),aImBOut.in()),
aTOut.out()
);
#if (ELISE_unix || ELISE_Cygwin || ELISE_MacOs)
string aCom="convert ephemeral:" + aNameDir + "Croped_images/" + aNameIm + ".tif " + aNameDir + "Croped_images/" + aNameIm;
system_call(aCom.c_str());
#endif
#if (ELISE_windows)
string aCom=MMDir() + "binaire-aux/convert ephemeral:" + aNameDir + "Croped_images/" + aNameIm + ".tif " + aNameDir + "Croped_images/" + aNameIm;
system_call(aCom.c_str());
#endif
}
示例10: aSzBrd
cTmpReechEpip::cTmpReechEpip
(
bool aConsChan,
const std::string & aNameOri,
Box2dr aBoxImIn,
ElDistortion22_Gen * anEpi,
Box2dr aBox,
double aStep,
const std::string & aNameOut,
const std::string & aPostMasq,
int aNumKer ,
bool Debug
) :
mBoxImIn(aBoxImIn),
mEpi (anEpi),
mStep (aStep),
mP0 (aBox._p0),
mSzEpi (aBox.sz()),
mSzRed (round_up (aBox.sz() / aStep) + Pt2di(1,1)),
mRedIMasq (mSzRed.x,mSzRed.y,0),
mRedTMasq (mRedIMasq),
mRedImX (mSzRed.x,mSzRed.y),
mRedTImX (mRedImX),
mRedImY (mSzRed.x,mSzRed.y),
mRedTImY (mRedImY)
{
cInterpolateurIm2D<REAL4> * aPtrSCI = 0;
if (aNumKer==0)
{
aPtrSCI = new cInterpolBilineaire<REAL4>;
}
else
{
cKernelInterpol1D * aKer = 0;
if (aNumKer==1)
aKer = new cCubicInterpKernel(-0.5);
else
aKer = new cSinCardApodInterpol1D(cSinCardApodInterpol1D::eTukeyApod,aNumKer,aNumKer/2,1e-4,false);
aPtrSCI = new cTabIM2D_FromIm2D<REAL4> (aKer,1000,false);
// cTabIM2D_FromIm2D<REAL4> aSSCI (&aKer,1000,false);
}
cInterpolateurIm2D<REAL4> & aSCI = *aPtrSCI;
Pt2di aPInd;
for (aPInd.x=0 ; aPInd.x<mSzRed.x ; aPInd.x++)
{
for (aPInd.y=0 ; aPInd.y<mSzRed.y ; aPInd.y++)
{
bool Ok= false;
Pt2dr aPEpi = ToFullEpiCoord(aPInd);
Pt2dr aPIm = anEpi->Inverse(aPEpi);
if ((aPIm.x>mBoxImIn._p0.x) && (aPIm.y>mBoxImIn._p0.y) && (aPIm.x<mBoxImIn._p1.x) && (aPIm.y<mBoxImIn._p1.y))
{
Pt2dr aPEpi2 = anEpi->Direct(aPIm);
if (euclid(aPEpi-aPEpi2) < 1e-2)
{
Ok= true;
mRedTMasq.oset(aPInd,Ok);
}
}
mRedTImX.oset(aPInd,aPIm.x);
mRedTImY.oset(aPInd,aPIm.y);
}
}
ELISE_COPY(mRedIMasq.all_pts(),dilat_d8(mRedIMasq.in(0),4),mRedIMasq.out());
Tiff_Im aTifOri = Tiff_Im::StdConvGen(aNameOri.c_str(),aConsChan ? -1 :1 ,true);
Tiff_Im aTifEpi = Debug ?
Tiff_Im(aNameOut.c_str()) :
Tiff_Im
(
aNameOut.c_str(),
mSzEpi,
aTifOri.type_el(),
Tiff_Im::No_Compr,
aTifOri.phot_interp()
) ;
Tiff_Im aTifMasq = aTifEpi;
bool ExportMasq = (aPostMasq!="NONE");
// std::cout << "POSTMAS " << aPostMasq << "\n";
if (ExportMasq)
{
std::string aNameMasq = StdPrefix(aNameOut)+ aPostMasq +".tif";
aTifMasq = Debug ?
Tiff_Im(aNameMasq.c_str()) :
//.........这里部分代码省略.........
示例11: ConputeEnveloppe
void cMMTP::ConputeEnveloppe(const cComputeAndExportEnveloppe & aCAEE,const cXML_ParamNuage3DMaille & aCurNuage)
{
mNameTargetEnv = mAppli.WorkDir() + TheDIRMergeEPI() + mAppli.PDV1()->Name() + "/NuageImProf_LeChantier_Etape_1.xml";
mNameTargetEnv = aCAEE.NuageExport().ValWithDef(mNameTargetEnv);
cXML_ParamNuage3DMaille aTargetNuage = StdGetFromSI(mNameTargetEnv,XML_ParamNuage3DMaille);
mZoomTargetEnv = aTargetNuage.SsResolRef().Val();
mSzTargetEnv = aTargetNuage.NbPixel();
double aZoomRel = mAppli.CurEtape()->DeZoomTer()/mZoomTargetEnv;
mBoxOutEnv._p0 = round_ni(Pt2dr(mBoxOutGlob._p0) * aZoomRel);
mBoxOutEnv._p1 = round_ni(Pt2dr(mBoxOutGlob._p1) * aZoomRel);
mBoxInEnv._p0 = round_ni(Pt2dr(mBoxInGlob._p0) * aZoomRel);
mBoxInEnv._p1 = round_ni(Pt2dr(mBoxInGlob._p1) * aZoomRel);
ELISE_ASSERT(mP0Tiep==Pt2di(0,0),"Too lazy to handle box maping");
double aPasPx = mAppli.CurEtape()->GeomTer().PasPxRel0();
//=============== READ PARAMS ====================
double aStepSsEch = aCAEE.SsEchFilter().Val();
int aSzFiltrer = aCAEE.SzFilter().Val();
double aProp = aCAEE.ParamPropFilter().Val();
int aDistProl = round_up( ElMax(aCAEE.ProlResolCur().Val(),aCAEE.ProlResolCible().Val()/aZoomRel) /aStepSsEch);
double aDistCum = (aCAEE.ProlDistAddMax().Val() / (aPasPx* aZoomRel));
double aDistAdd = (aCAEE.ProlDistAdd().Val()*aStepSsEch ) / (aPasPx);
std::cout << "DIST CUM " << aDistCum << " DADD " << aDistAdd << "\n";
//===================================
ElTimer aChrono;
int aSeuilNbV = 2 * (1+2*aSzFiltrer); // Au moins une bande de 2 pixel pour inferer qqch
Pt2di aSzRed = round_up(Pt2dr(mSzTiep)/aStepSsEch);
Im2D_Bits<1> aMasqRed(aSzRed.x,aSzRed.y,0);
TIm2DBits<1> aTMR(aMasqRed);
/*
TIm2D<INT2,INT> aPMaxRed(aSzRed);
TIm2D<INT2,INT> aPMinRed(aSzRed);
*/
TIm2D<REAL4,REAL> aPMaxRed(aSzRed);
TIm2D<REAL4,REAL> aPMinRed(aSzRed);
// Calcul du filtre de reduction
Pt2di aPRed;
for (aPRed.y = 0 ; aPRed.y<aSzRed.y ; aPRed.y++)
{
for (aPRed.x = 0 ; aPRed.x<aSzRed.x ; aPRed.x++)
{
Pt2di aPR1 = round_ni(Pt2dr(aPRed)*aStepSsEch);
int anX0 = ElMax(0,aPR1.x-aSzFiltrer);
int anX1 = ElMin(mSzTiep.x-1,aPR1.x+aSzFiltrer);
int anY0 = ElMax(0,aPR1.y-aSzFiltrer);
int anY1 = ElMin(mSzTiep.y-1,aPR1.y+aSzFiltrer);
std::vector<REAL> aVVals;
Pt2di aVoisR1;
for (aVoisR1.x=anX0 ; aVoisR1.x<=anX1 ; aVoisR1.x++)
{
for (aVoisR1.y=anY0 ; aVoisR1.y<=anY1 ; aVoisR1.y++)
{
if (mTImMasqInit.get(aVoisR1))
aVVals.push_back( mTCBT.get(aVoisR1));
// aVVals.push_back( mTImProf.get(aVoisR1));
}
}
if (int(aVVals.size()) >= aSeuilNbV)
{
REAL4 aVMax = KthValProp(aVVals,aProp);
REAL4 aVMin = KthValProp(aVVals,1-aProp);
aPMaxRed.oset(aPRed,aVMax);
aPMinRed.oset(aPRed,aVMin);
aTMR.oset(aPRed,1);
ELISE_ASSERT(aVMin<=aVMax,"Mic>Max !!!! in BasicMMTiep");
}
else
{
aPMaxRed.oset(aPRed,-32000);
aPMinRed.oset(aPRed, 32000);
}
}
}
//Tiff_Im::Create8BFromFonc("TDifInit.tif",aSzRed,Max(0,Min(255,Iconv(aPMaxRed._the_im.in()-aPMinRed._the_im.in()))));
Im2D_Bits<1> aNewM(1,1);
Im2D_REAL4 aNewMax = ProlongByCont (aNewM,aMasqRed,aPMaxRed._the_im,aDistProl,aDistAdd,aDistCum);
Im2D_REAL4 aNewMin = ProlongByCont (aNewM,aMasqRed,aPMinRed._the_im,aDistProl,-aDistAdd,aDistCum);
ELISE_COPY(select(aNewM.all_pts(),!aNewM.in()),0,aNewMax.out()|aNewMin.out());
// fChCo = Virgule(FX,FY)/ (aStepSsEch * aZoomRel);
// fMasq = aNewM.in(0)[fChCo];
// fMasqBin = fMasq>0.5;
//.........这里部分代码省略.........
示例12: ApplyParralaxCor_main
int ApplyParralaxCor_main(int argc, char ** argv)
{
//std::string aNameIm, aNameIm2, aNameParallax, aNameDEM;
std::string aNameIm, aNameParallax;
std::string aNameOut = "";
//Reading the arguments
ElInitArgMain
(
argc, argv,
LArgMain()
<< EAMC(aNameIm, "Image to be corrected", eSAM_IsPatFile)
//<< EAMC(aNameIm2, "Other image", eSAM_IsPatFile)
<< EAMC(aNameParallax, "Paralax correction file", eSAM_IsPatFile),
//<< EAMC(aNameDEM, "DEM file", eSAM_IsPatFile),
LArgMain()
<< EAM(aNameOut, "Out", true, "Name of output image (Def=ImName_corrected.tif")
);
std::string aDir, aPatIm;
SplitDirAndFile(aDir, aPatIm, aNameIm);
cout << "Correcting " << aNameIm << endl;
if (aNameOut == "")
aNameOut = aNameIm + "_corrected.tif";
//Reading the image and creating the objects to be manipulated
Tiff_Im aTF = Tiff_Im::StdConvGen(aDir + aNameIm, 1, false);
Pt2di aSz = aTF.sz(); cout << "size of image = " << aSz << endl;
Im2D_U_INT1 aIm(aSz.x, aSz.y);
ELISE_COPY
(
aTF.all_pts(),
aTF.in(),
aIm.out()//Virgule(aImR.out(),aImG.out(),aImB.out())
);
U_INT1 ** aData = aIm.data();
//Reading the parallax correction file
Tiff_Im aTFPar = Tiff_Im::StdConvGen(aDir + aNameParallax, 1, false);
Im2D_REAL8 aPar(aSz.x, aSz.y);
ELISE_COPY
(
aTFPar.all_pts(),
aTFPar.in(),
aPar.out()//Virgule(aImR.out(),aImG.out(),aImB.out())
);
REAL8 ** aDatPar = aPar.data();
//Output container
Im2D_U_INT1 aImOut(aSz.x, aSz.y);
U_INT1 ** aDataOut = aImOut.data();
/*Things needed for RPC angle computation, not main goal of this function
//Read RPCs
RPC aRPC;
string aNameRPC1 = "RPC_" + StdPrefix(aNameIm) + ".xml";
aRPC.ReadDimap(aNameRPC1);
cout << "Dimap File " << aNameRPC1 << " read" << endl;
RPC aRPC2;
string aNameRPC2 = "RPC_" + StdPrefix(aNameIm2) + ".xml";
aRPC2.ReadDimap(aNameRPC2);
cout << "Dimap File " << aNameRPC2 << " read" << endl;
//Reading the DEM file
Tiff_Im aTFDEM = Tiff_Im::StdConvGen(aDir + aNameDEM, 1, false);
Im2D_REAL8 aDEM(aSz.x, aSz.y);
ELISE_COPY
(
aTFDEM.all_pts(),
aTFDEM.in(),
aDEM.out()
);
REAL8 ** aDatDEM = aDEM.data();
//Output angle container 1
Im2D_REAL8 aAngleBOut(aSz.x, aSz.y);
REAL8 ** aDataAngleBOut = aAngleBOut.data();
string aNameAngleB = "AngleB.tif";
//Output angle container 2
Im2D_REAL8 aAngleNOut(aSz.x, aSz.y);
REAL8 ** aDataAngleNOut = aAngleNOut.data();
string aNameAngleN = "AngleN.tif";
*/
//Pt3dr PBTest(1500,3000, 0);
//Pt3dr PWTest = aRPC.DirectRPC(PBTest);
//Pt3dr PNTest = aRPC2.InverseRPC(PWTest);
//cout << "PB0 = " << PBTest << endl;
//cout << "PW0 = " << PWTest << endl;
//cout << "PN0 = " << PNTest << endl;
//cout << aRPC.height_scale << " " << aRPC.height_off << endl;
//PBTest.z=1000;
//PWTest = aRPC.DirectRPC(PBTest);
//PNTest = aRPC2.InverseRPC(PWTest);
//cout << "PB1 = " << PBTest << endl;
//.........这里部分代码省略.........
示例13: DoCorrelLeastQuare
void cAppliMICMAC::DoCorrelLeastQuare(const Box2di & aBoxOut,const Box2di & aBoxIn,const cCorrel2DLeastSquare & aClsq)
{
int aPer = aClsq.PeriodEch();
cOneTestLSQ aTest
(
TheNbIterLine,
PDV1()->LoadedIm().DataFloatIm()[0],PDV1()->LoadedIm().SzIm(),
PDV2()->LoadedIm().DataFloatIm()[0],PDV2()->LoadedIm().SzIm(),
CurEtape()->InterpFloat(),
aClsq
);
Pt2di aP0Red = round_up(Pt2dr(aBoxOut._p0) / double(aPer));
Pt2di aP1Red = round_up(Pt2dr(aBoxOut._p1) / double(aPer));
Pt2di aSzRed = aP1Red - aP0Red;
Im2D_REAL8 aImDepX(aSzRed.x,aSzRed.y);
Im2D_REAL8 aImDepY(aSzRed.x,aSzRed.y);
Pt2di aPRed;
const cOneNappePx & aPx1 = mLTer->KthNap(0);
const cOneNappePx & aPx2 = mLTer->KthNap(1);
for (aPRed.x=aP0Red.x ; aPRed.x<aP1Red.x ; aPRed.x++)
{
for (aPRed.y=aP0Red.y ; aPRed.y<aP1Red.y ; aPRed.y++)
{
// std::cout <<"REST " << aP1Red - aPRed << "\n";
Pt2di aP = aPRed * aPer;
Pt2di aPLoc = aP-aBoxIn._p0;
double aPx[2];
aPx[0] = aPx1.mTPxInit.get(aPLoc);
aPx[1] = aPx2.mTPxInit.get(aPLoc);
mCurEtape->GeomTer().PxDisc2PxReel(aPx,aPx);
//aTest.SetPIm1(PDV1()->Geom().CurObj2Im(Pt2dr(aP),aPx));
//aTest.SetPIm2(PDV2()->Geom().CurObj2Im(Pt2dr(aP),aPx));
aTest.MinimByLSQandGolden
(
PDV1()->Geom().CurObj2Im(Pt2dr(aP),aPx),
PDV2()->Geom().CurObj2Im(Pt2dr(aP),aPx)
);
double aPx0[2]={0,0};
Pt2dr aP20 = PDV2()->Geom().CurObj2Im(Pt2dr(aP),aPx0);
Pt2dr aP2 = aTest.Im2().PImCur();
aImDepX.SetR(aPRed-aP0Red,aP2.x-aP20.x);
aImDepY.SetR(aPRed-aP0Red,aP2.y-aP20.y);
}
}
Tiff_Im aFileRX = mCurEtape->KPx(0).FileIm();
Tiff_Im aFileRY = mCurEtape->KPx(1).FileIm();
ELISE_COPY
(
rectangle(aP0Red,aP1Red),
trans(aImDepX.in(),-aP0Red),
aFileRX.out()
);
ELISE_COPY
(
rectangle(aP0Red,aP1Red),
trans(aImDepY.in(),-aP0Red),
aFileRY.out()
);
/*
*/
}
示例14: Luc_main_truc
int Luc_main_truc(int argc, char ** argv)
{
/*
std::string aFullPattern, aOri, aNameOut="PointsCordinates.txt";
//Reading the arguments
ElInitArgMain
(
argc, argv,
LArgMain() << EAMC(aFullPattern, "Images Pattern 1", eSAM_IsPatFile)
<< EAMC(aOri, "Orientation", eSAM_IsPatFile),
LArgMain() << EAM(aNameOut, "Out", true, "Output file (txt)")
);
string aPattern, aNameDir;
SplitDirAndFile(aNameDir, aPattern, aFullPattern);
//Reading input files
list<string> ListIm = RegexListFileMatch(aNameDir, aPattern, 1, false);
int nbIm = ListIm.size();
string oriFileName = aNameDir + aNameOut;
FILE *f = fopen(oriFileName.c_str(), "w");
for (int i = 1; i <= nbIm; i++)
{
//Processing the image
string aNameIm = ListIm.front();
ListIm.pop_front();
string aNameOut = aNameDir + aNameIm + ".tif";
//Loading the camera
string aNameCam = "Ori-" + aOri + "/Orientation-" + aNameIm + ".xml";
cInterfChantierNameManipulateur * anICNM = cInterfChantierNameManipulateur::BasicAlloc(aNameDir);
CamStenope * aCam = CamOrientGenFromFile(aNameCam, anICNM);
cout << aNameIm << " [ " << aCam->VraiOpticalCenter().x << " , " << aCam->VraiOpticalCenter().y << " , " << aCam->VraiOpticalCenter().z << " ]" << endl;
fprintf(f, "%s %0.6f %0.6f %0.6f\n", aNameIm, aCam->VraiOpticalCenter().x, aCam->VraiOpticalCenter().y, aCam->VraiOpticalCenter().z);
}
fclose(f);
*/
std::string aFullPattern1, aFullPattern2, aFile3D1, aFile3D2, aOri, aDirOut = "Visualisation/";
int aSzW = 1;
double aSzMovArea = 5;
//Reading the arguments
ElInitArgMain
(
argc, argv,
LArgMain() << EAMC(aFullPattern1, "Images Pattern 1", eSAM_IsPatFile)
<< EAMC(aFullPattern2, "Images Pattern 2", eSAM_IsPatFile)
<< EAMC(aFile3D1, "File 3D 1", eSAM_IsPatFile)
<< EAMC(aFile3D2, "File 3D 2", eSAM_IsPatFile)
<< EAMC(aOri, "Orientation", eSAM_IsPatFile),
LArgMain() << EAM(aDirOut, "Out", true, "Output folder (end with /) and/or prefix (end with another char)")
<< EAM(aSzMovArea, "SzMovArea", true, "Max magnitude of movement in meters (def=5)")
);
//Creating vector of images
std::string aDir, aPatIm1, aPatIm2;
SplitDirAndFile(aDir, aPatIm1, aFullPattern1);
SplitDirAndFile(aDir, aPatIm2, aFullPattern2);
cInterfChantierNameManipulateur * aICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
const std::vector<std::string> * aSetIm1 = aICNM->Get(aPatIm1);
const std::vector<std::string> * aSetIm2 = aICNM->Get(aPatIm2);
std::vector<std::string> aVectIm1 = *aSetIm1;
std::vector<std::string> aVectIm2 = *aSetIm2;
cout << "Set 1 size : " << aVectIm1.size() << endl;
cout << "Set 1 : " << aVectIm1 << endl;
cout << "Set 2 size : " << aVectIm2.size() << endl;
cout << "Set 2 : " << aVectIm2 << endl;
//loading 3D models
cElNuage3DMaille * info3D1 = cElNuage3DMaille::FromFileIm(aFile3D1);
cElNuage3DMaille * info3D2 = cElNuage3DMaille::FromFileIm(aFile3D2);
cout << "Sz geom 1: " << info3D1->SzGeom() << endl;
cout << "Sz geom 2: " << info3D2->SzGeom() << endl;
cout << "Resol geom 1: " << info3D1->ResolSolGlob() << endl;
cout << "Resol geom 2: " << info3D2->ResolSolGlob() << endl;
//Loading images
vector<SpatioTempImage> aGrIm1 = LoadGrpImages(aDir, aPatIm1, aOri);
vector<SpatioTempImage> aGrIm2 = LoadGrpImages(aDir, aPatIm2, aOri);
cout << "Loaded " << aGrIm1.size() << " images for group 1 and " << aGrIm2.size() << " for group 2" << endl;
//Bulding the output file system
ELISE_fp::MkDirRec(aDir + aDirOut);
std::string aNameOut = "banane.tif";
//Reading the image and creating the objects to be manipulated
aNameOut = aDir + aDirOut + aNameOut;
Pt2di aSz( info3D1->SzGeom().x , info3D1->SzGeom().y );
Tiff_Im aTF = Tiff_Im(aNameOut.c_str(), aSz, GenIm::real4, Tiff_Im::No_Compr, Tiff_Im::BlackIsZero);
Im2D_REAL4 aIm(aSz.x, aSz.y);
//.........这里部分代码省略.........
示例15: Drunk
void Drunk(string aFullPattern,string aOri,string DirOut, bool Talk)
{
string aPattern,aNameDir;
SplitDirAndFile(aNameDir,aPattern,aFullPattern);
//Reading input files
list<string> ListIm=RegexListFileMatch(aNameDir,aPattern,1,false);
int nbIm=ListIm.size();
if (Talk){cout<<"Images to process: "<<nbIm<<endl;}
//Paralelizing (an instance of Drunk is called for each image)
string cmdDRUNK;
list<string> ListDrunk;
if(nbIm!=1)
{
for(int i=1;i<=nbIm;i++)
{
string aFullName=ListIm.front();
ListIm.pop_front();
cmdDRUNK=MMDir() + "bin/Drunk " + aNameDir + aFullName + " " + aOri + " Out=" + DirOut + " Talk=0";
ListDrunk.push_back(cmdDRUNK);
}
cEl_GPAO::DoComInParal(ListDrunk,aNameDir + "MkDrunk");
//Calling the banner at the end
if (Talk){Drunk_Banniere();}
}else{
//Bulding the output file system
ELISE_fp::MkDirRec(aNameDir + DirOut);
//Processing the image
string aNameIm=ListIm.front();
string aNameOut=aNameDir + DirOut + aNameIm + ".tif";
//Loading the camera
string aNameCam="Ori-"+aOri+"/Orientation-"+aNameIm+".xml";
cInterfChantierNameManipulateur * anICNM = cInterfChantierNameManipulateur::BasicAlloc(aNameDir);
CamStenope * aCam = CamOrientGenFromFile(aNameCam,anICNM);
//Reading the image and creating the objects to be manipulated
Tiff_Im aTF= Tiff_Im::StdConvGen(aNameDir + aNameIm,3,false);
Pt2di aSz = aTF.sz();
Im2D_U_INT1 aImR(aSz.x,aSz.y);
Im2D_U_INT1 aImG(aSz.x,aSz.y);
Im2D_U_INT1 aImB(aSz.x,aSz.y);
Im2D_U_INT1 aImROut(aSz.x,aSz.y);
Im2D_U_INT1 aImGOut(aSz.x,aSz.y);
Im2D_U_INT1 aImBOut(aSz.x,aSz.y);
ELISE_COPY
(
aTF.all_pts(),
aTF.in(),
Virgule(aImR.out(),aImG.out(),aImB.out())
);
U_INT1 ** aDataR = aImR.data();
U_INT1 ** aDataG = aImG.data();
U_INT1 ** aDataB = aImB.data();
U_INT1 ** aDataROut = aImROut.data();
U_INT1 ** aDataGOut = aImGOut.data();
U_INT1 ** aDataBOut = aImBOut.data();
//Parcours des points de l'image de sortie et remplissage des valeurs
Pt2dr ptOut;
for (int aY=0 ; aY<aSz.y ; aY++)
{
for (int aX=0 ; aX<aSz.x ; aX++)
{
ptOut=aCam->DistDirecte(Pt2dr(aX,aY));
aDataROut[aY][aX] = Reechantillonnage::biline(aDataR, aSz.x, aSz.y, ptOut);
aDataGOut[aY][aX] = Reechantillonnage::biline(aDataG, aSz.x, aSz.y, ptOut);
aDataBOut[aY][aX] = Reechantillonnage::biline(aDataB, aSz.x, aSz.y, ptOut);
}
}
Tiff_Im aTOut
(
aNameOut.c_str(),
aSz,
GenIm::u_int1,
Tiff_Im::No_Compr,
Tiff_Im::RGB
);
ELISE_COPY
(
aTOut.all_pts(),
Virgule(aImROut.in(),aImGOut.in(),aImBOut.in()),
aTOut.out()
);
}
}