本文整理汇总了C++中Tiff_Im::all_pts方法的典型用法代码示例。如果您正苦于以下问题:C++ Tiff_Im::all_pts方法的具体用法?C++ Tiff_Im::all_pts怎么用?C++ Tiff_Im::all_pts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiff_Im
的用法示例。
在下文中一共展示了Tiff_Im::all_pts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()
);
}
示例2:
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);
}
}
示例3: aSO
void cPackObsLiaison::GetPtsTerrain
(
const cParamEstimPlan & aPEP,
cSetName & aSelectorEstim,
cArgGetPtsTerrain & anArg,
const char * anAttr
)
{
cStatObs aSO(false);
if ( aPEP.AttrSup().IsInit())
anAttr = aPEP.AttrSup().Val().c_str();
ELISE_ASSERT
(
mIsMult,
"Require PMUL for cPackObsLiaison::GetPtsTerrain"
);
cPonderationPackMesure aPPM = aPEP.Pond();
aPPM.Add2Compens().SetVal(false);
for
(
std::map<std::string,cObsLiaisonMultiple *>::iterator itOML=mDicoMul.begin();
itOML!=mDicoMul.end();
itOML++
)
{
cObsLiaisonMultiple * anOLM = itOML->second;
std::string aNameP = anOLM->Pose1()->Name();
if (aSelectorEstim.IsSetIn(aNameP))
{
Im2D_Bits<1> aM(1,1);
if (aPEP.KeyCalculMasq().IsInit())
{
std::string aNameM =
anAttr ?
mAppli.ICNM()->Assoc1To2(aPEP.KeyCalculMasq().Val(),aNameP,anAttr,true):
mAppli.ICNM()->StdCorrect(aPEP.KeyCalculMasq().Val(),aNameP,true);
aNameM = mAppli.DC() + aNameM;
Tiff_Im aTF = Tiff_Im::UnivConvStd(aNameM);
Pt2di aSz = aTF.sz();
aM = Im2D_Bits<1>(aSz.x,aSz.y);
ELISE_COPY(aTF.all_pts(),aTF.in_bool(),aM.out());
anArg.SetMasq(&aM);
}
anOLM->AddObsLM(aPPM,0,&anArg,(cArgVerifAero*)0,aSO,0);
anArg.SetMasq(0);
}
}
}
示例4: 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()
);
}
示例5: TestNtt
void TestNtt(const std::string &aName)
{
Tiff_Im aTF = Tiff_Im::StdConvGen(aName,1,true);
Pt2di aSz = aTF.sz();
Im2D_REAL4 aI0(aSz.x,aSz.y);
ELISE_COPY( aTF.all_pts(),aTF.in(),aI0.out());
int aWSz=2;
TIm2D<REAL4,REAL8> aTIm(aI0);
double aSomGlob=0.0;
double aNbGlob=0.0;
for (int aKdx=-aWSz ; aKdx<=aWSz ; aKdx+=aWSz)
{
printf("## ");
for (int aKdy=-aWSz ; aKdy<=aWSz ; aKdy+=aWSz)
{
int aDx = aKdx;
int aDy = aKdy;
Pt2di aDep(aDx,aDy);
Pt2di aP;
RMat_Inertie aMat;
for (aP.x = aWSz ; aP.x<aSz.x-aWSz ; aP.x++)
{
for (aP.y=aWSz ; aP.y<aSz.y-aWSz ; aP.y++)
{
aMat.add_pt_en_place(aTIm.get(aP),aTIm.get(aP+aDep));
}
}
double aC = aMat.correlation();
aC = 1-aC;
if (dist8(aDep) == aWSz)
{
aSomGlob += aC;
aNbGlob ++;
}
printf(" %4d",round_ni(10000*(aC)));
}
printf("\n");
}
aSomGlob /= aNbGlob;
std::cout << " G:" << aSomGlob << "\n";
printf("\n\n");
}
示例6: DebugDrag
void DebugDrag()
{
std::string aDir = "/media/data1/Jeux-Tests/Dragon-2/MEC2Im-Epi_Im1_Right_IMGP7511_IMGP7512.tif-Epi_Im2_Left_IMGP7511_IMGP7512.tif/";
std::string aNamePx = "Px1_Num6_DeZoom2_LeChantier.tif";
std::string aNameMasq = "AutoMask_LeChantier_Num_5.tif";
Tiff_Im aTP = Tiff_Im::StdConv(aDir+aNamePx);
Tiff_Im aTM = Tiff_Im::StdConv(aDir+aNameMasq);
double aMinPx;
ELISE_COPY
(
aTP.all_pts(),
aTP.in() * aTM.in(),
VMin(aMinPx)
);
std::cout << "MIN PX " << aMinPx << "\n";
}
示例7: SobelTestNtt
void SobelTestNtt(const std::string &aName)
{
Tiff_Im aTF = Tiff_Im::StdConvGen(aName,1,true);
Pt2di aSz = aTF.sz();
Im2D_REAL4 aI0(aSz.x,aSz.y);
ELISE_COPY( aTF.all_pts(),aTF.in(),aI0.out());
Video_Win * aW=0;
// aW = Video_Win::PtrWStd(aSz);
if (aW)
{
ELISE_COPY(aW->all_pts(),Min(255,aI0.in()/256.0),aW->ogray());
aW->clik_in();
}
Fonc_Num aF1 = sobel(aI0.in_proj());
Fonc_Num aF2 = aI0.in_proj();
for (int aK=0 ; aK<3 ; aK++)
aF2 = rect_som(aF2,1) / 9.0;
aF2 = sobel(aF2);
if (aW)
{
ELISE_COPY(aW->all_pts(),Min(255, 200 * (aF1/Max(aF2,1e-7))),aW->ogray());
aW->clik_in();
}
double aSF1,aSF2,aSomPts;
ELISE_COPY(aI0.all_pts(),Virgule(aF1,aF2,1.0),Virgule(sigma(aSF1),sigma(aSF2),sigma(aSomPts)));
std::cout << "Indice " << aSF1 / aSF2 << "\n";
}
示例8: PreparSift_Main
int PreparSift_Main(int argc,char ** argv)
{
double aPEg = 1.0;
double aPSrtEg = 3.0;
double aPM = 2.0;
std::string aNameIn,aNameOut="Sift.tif";
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aNameIn,"Full name (Dir+Pattern)", eSAM_IsPatFile),
LArgMain() << EAM(aNameOut,"NameOut",true)
);
Tiff_Im aTif = Tiff_Im::StdConvGen(aNameIn,1,true);
// Init Mems
Pt2di aSz = aTif.sz();
Im2D_U_INT2 anIm(aSz.x,aSz.y);
Im1D_REAL8 aH(aNbH,0.0);
// Load image
{
Symb_FNum aFTif(aTif.in());
ELISE_COPY(aTif.all_pts(),aFTif,anIm.out()| (aH.histo().chc(aFTif)<<1) );
}
Im1D_REAL8 aHSqrt(aNbH,0.0);
ELISE_COPY(aH.all_pts(),sqrt(aH.in()),aHSqrt.out());
int aVMax =0;
// Calcul Histo
MakeFoncRepart(aH,&aVMax);
MakeFoncRepart(aHSqrt);
// Fonc Loc
Fonc_Num aFonc(Rconv(anIm.in_proj()));
Fonc_Num aS1S2 = Virgule(aFonc,Square(aFonc));
for (int aK=0 ; aK< TheNbIter ; aK++)
{
aS1S2 = rect_som(aS1S2,TheNbVois) / ElSquare(1+2*TheNbVois);
}
Symb_FNum aFS1 = aS1S2.v0();
Symb_FNum aFS2 = aS1S2.v1()-Square(aFS1);
Fonc_Num aFLoc = (anIm.in()-aFS1) / sqrt(Max(1.0,aFS2));
// aFLoc = aFLoc * 20;
aFLoc = atan(aFLoc) /(PI/2);
// Symb_FNum aFonc(aTif.in());
std::cout << "MaxMin " << aVMax << "\n";
Fonc_Num aFEg = aH.in()[anIm.in()];
Fonc_Num aFEgS = aHSqrt.in()[anIm.in()];
Fonc_Num aFM = anIm.in() * (255.0 / aVMax);
// Fonc_Num aFRes = (aFEg*aPEg + aFM * aPM + aFEgS*aPSrtEg + aFLoc) / (aPEg + aPM + aPSrtEg);
Symb_FNum aFMoy = (aFEg*aPEg + aFM * aPM + aFEgS*aPSrtEg ) / (aPEg + aPM + aPSrtEg);
Symb_FNum aFMarge = Min(64,Min(aFMoy,255-aFMoy));
Fonc_Num aFRes = aFMoy + aFMarge * aFLoc;
/*
Fonc_Num aFRes = Max(0,Min(255,aFMoy + 60 * aFLoc));
*/
Tiff_Im::Create8BFromFonc(aNameOut,aSz,aFRes);
return EXIT_SUCCESS;
}
示例9: 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()
);
}
}
示例10: 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()
);
}
}
示例11: 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;
}
}
}
示例12: MakeExport
void cModeleAnalytiqueComp::MakeExport()
{
if (!mModele.MakeExport().Val())
return;
cMatrCorresp * pMatr = GetMatr(mModele.PasCalcul(),mModele.PointUnique().Val());
const ElPackHomologue * aPackIn =0;
ElPackHomologue aPackRef;
ElPackHomologue aNewPack;
if (mModele.UseHomologueReference().Val())
{
aPackRef = mAppli.PDV1()->ReadPackHom(mAppli.PDV2());
aPackIn = & aPackRef;
}
else
{
aPackIn = & pMatr->PackHomCorr();
}
/*
* FILTRAGE EVENTUEL DES POINTS HOMOLOGUES
*/
double aTol = mAppli.TolerancePointHomInImage().Val();
double aFiltre = mAppli.FiltragePointHomInImage().Val();
bool GotOut = false;
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
//.........这里部分代码省略.........
示例13: if
//.........这里部分代码省略.........
{
ELISE_ASSERT(false,"Geometrie destination non traitee dans le basculement");
}
Pt2dr aP0 = mGeomTer.DiscToR2(Pt2di(0,0));
Pt2dr aP1 = mGeomTer.DiscToR2(Pt2di(1,1));
cBasculeMNT aBasc
(
mGeomTer,
aP0,
aP1-aP0,
anOri.OriginePlani(),
anOri.ResolutionPlani(),
aGeomB,
mIsOptimCont,
aDataF,
aDataI,
aSzData
);
Pt2di anOffset;
double aDef = -1e10;
double aSousDef = -9e9;
std::cout << "BEGIN BASCULE \n";
//Im2D_REAL4 aMnt= aBasc.Basculer(anOffset,aP0Sauv,aP1Sauv,aDef);
Im2D_REAL4 aMnt= aBasc.BasculerAndInterpoleInverse(anOffset,aP0Sauv,aP1Sauv,(float)aDef);
ELISE_COPY
(
select(aMnt.all_pts(),aMnt.in() > aSousDef),
(aMnt.in()-anOri.OrigineAlti())/anOri.ResolutionAlti(),
aMnt.out()
);
std::cout << anOffset << " " << aMnt.sz();
std::cout << "END BASCULE \n";
bool isNewFile;
Tiff_Im aFileRes = Tiff_Im::CreateIfNeeded
(
isNewFile,
anOri.NameFileMnt(),
anOri.NombrePixels(),
GenIm::real4,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero
);
Tiff_Im * aFileMasq =0;
if ( anOri.NameFileMasque().IsInit())
{
aFileMasq = new Tiff_Im(Tiff_Im::CreateIfNeeded
(
isNewFile,
anOri.NameFileMasque().Val(),
anOri.NombrePixels(),
GenIm::bits1_msbf,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero
)
);
}
示例14: 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
}
示例15: 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;
//.........这里部分代码省略.........