本文整理汇总了C++中Tiff_Im::sz方法的典型用法代码示例。如果您正苦于以下问题:C++ Tiff_Im::sz方法的具体用法?C++ Tiff_Im::sz怎么用?C++ Tiff_Im::sz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiff_Im
的用法示例。
在下文中一共展示了Tiff_Im::sz方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PartitionRenato
void PartitionRenato(int argc,char** argv)
{
std::string aName;
double aPropSzW=0.1,aSeuil=75;
double aPropExag = 0.1;
int aNbIter = 3;
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aName,"Name Input"),
LArgMain() << EAM(aPropSzW,"PropSzW",true,"Prop Size of W, def =0.1")
<< EAM(aSeuil,"Seuil",true,"Threshold beetween Black & White, Def=75")
);
Tiff_Im aTIn = Tiff_Im::UnivConvStd(aName);
Pt2di aSz = aTIn.sz();
int aSzW = round_ni((euclid(aSz)*aPropSzW) / sqrt(aNbIter));
Im2D_REAL4 anIm0(aSz.x,aSz.y);
Im2D_REAL4 anIm1(aSz.x,aSz.y);
Im2D_U_INT1 aImInside(aSz.x,aSz.y,1);
ELISE_COPY(anIm0.all_pts(),255-aTIn.in(),anIm0.out());
int aNbF = 3;
for (int aKF=0 ; aKF<aNbF ; aKF++)
{
Im2D_REAL4 anImFond(aSz.x,aSz.y);
Fonc_Num aFIn = anIm0.in(0);
for (int aK=0 ; aK<aNbIter ; aK++)
aFIn = (rect_som(aFIn,aSzW)*aImInside.in(0)) / Max(1.0,rect_som(aImInside.in(0),aSzW));
ELISE_COPY(anImFond.all_pts(),aFIn,anImFond.out());
if (aKF == (aNbF-1))
{
Fonc_Num aF = anIm0.in()-anImFond.in();
aF = aF / aSeuil;
aF = (aF -0.1) / (1-2*aPropExag);
aF = Max(0.0,Min(1.0,aF));
ELISE_COPY(anIm1.all_pts(),255.0 *(1-aF),anIm1.out());
}
else
{
ELISE_COPY
(
aImInside.all_pts(),
anIm0.in() < anImFond.in()+aSeuil,
aImInside.out()
);
}
}
Tiff_Im::Create8BFromFonc(std::string("Bin-")+StdPrefix(aName)+".tif",aTIn.sz(),anIm1.in());
}
示例2:
bool MultiChannel<tData>::read_tiff( Tiff_Im &i_tiff ) // Tiff_Im is not const because of ReadVecOfIm
{
if ( i_tiff.type_el()!=typeEl() ) return false;
vector<Im2DGen *> tiffChannels = i_tiff.ReadVecOfIm();
resize( i_tiff.sz().x, i_tiff.sz().y, i_tiff.nb_chan() );
for ( size_t i=0; i<mChannels.size(); i++ )
set( i, *(Im2D<tData,tBase>*)tiffChannels[i] );
return true;
}
示例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: 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");
}
示例5: GetMasqSubResol
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;
}
示例6: 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";
}
示例7: 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()) :
//.........这里部分代码省略.........
示例8: HomFilterMasq_main
int HomFilterMasq_main(int argc,char ** argv)
{
// MemoArg(argc,argv);
MMD_InitArgcArgv(argc,argv);
std::string aDir,aPat,aFullDir;
bool ExpTxt=false;
std::string PostPlan="_Masq";
std::string KeyCalcMasq;
std::string KeyEquivNoMasq;
std::string MasqGlob;
double aResol=10;
bool AcceptNoMask;
std::string aPostIn= "";
std::string aPostOut= "MasqFiltered";
std::string aOriMasq3D,aNameMasq3D;
cMasqBin3D * aMasq3D = 0;
Pt2dr aSelecTer;
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aFullDir,"Full name (Dir+Pat)", eSAM_IsPatFile),
LArgMain()
<< EAM(PostPlan,"PostPlan",true,"Post to plan, Def : toto ->toto_Masq.tif like with SaisieMasq")
<< EAM(MasqGlob,"GlobalMasq",true,"Global Masq to add to all image")
<< EAM(KeyCalcMasq,"KeyCalculMasq",true,"For tuning masq per image")
<< EAM(KeyEquivNoMasq,"KeyEquivNoMasq",true,"When given if KENM(i1)==KENM(i2), don't masq")
<< EAM(aResol,"Resol",true,"Sub Resolution for masq storing, Def=10")
<< EAM(AcceptNoMask,"ANM",true,"Accept no mask, def = true if MasqGlob and false else")
<< EAM(ExpTxt,"ExpTxt",true,"Ascii format for in and out, def=false")
<< EAM(aPostIn,"PostIn",true,"Post for Input dir Hom, Def=")
<< EAM(aPostOut,"PostOut",true,"Post for Output dir Hom, Def=MasqFiltered")
<< EAM(aOriMasq3D,"OriMasq3D",true,"Orientation for Masq 3D")
<< EAM(aNameMasq3D,"Masq3D",true,"File of Masq3D, Def=AperiCloud_${OriMasq3D}.ply")
<< EAM(aSelecTer,"SelecTer",true,"[Per,Prop] Period of tiling on ground selection, Prop=proporion of selected")
);
bool aHasOri3D = EAMIsInit(&aOriMasq3D);
bool HasTerSelec = EAMIsInit(&aSelecTer);
#if (ELISE_windows)
replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
#endif
SplitDirAndFile(aDir,aPat,aFullDir);
if (EAMIsInit(&PostPlan))
{
CorrecNameMasq(aDir,aPat,PostPlan);
}
if (!EAMIsInit(&AcceptNoMask))
AcceptNoMask = EAMIsInit(&MasqGlob) || aHasOri3D;
cInterfChantierNameManipulateur * anICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
std::string aKeyOri;
if (aHasOri3D)
{
anICNM->CorrecNameOrient(aOriMasq3D);
if (! EAMIsInit(&aNameMasq3D))
{
aNameMasq3D = aDir + "AperiCloud_" + aOriMasq3D + "_polyg3d.xml";
}
if (ELISE_fp::exist_file(aDir+aNameMasq3D))
{
aMasq3D = cMasqBin3D::FromSaisieMasq3d(aDir+aNameMasq3D);
}
else
{
ELISE_ASSERT(EAMIsInit(&aSelecTer),"Unused OriMasq3D");
}
aKeyOri = "[email protected]" + aOriMasq3D;
}
Im2D_Bits<1> aImMasqGlob(1,1);
if (EAMIsInit(&MasqGlob))
aImMasqGlob = GetMasqSubResol(aDir+MasqGlob,aResol);
const std::vector<std::string> * aVN = anICNM->Get(aPat);
std::vector<Im2D_Bits<1> > aVMasq;
std::vector<CamStenope *> aVCam;
double aResolMoy = 0;
for (int aKN = 0 ; aKN<int(aVN->size()) ; aKN++)
{
std::string aNameIm = (*aVN)[aKN];
Tiff_Im aTF = Tiff_Im::StdConvGen(aNameIm,1,false);
Pt2di aSzG = aTF.sz();
Pt2di aSzR (round_ni(Pt2dr(aSzG)/aResol));
Im2D_Bits<1> aImMasq(aSzR.x,aSzR.y,1);
std::string aNameMasq = StdPrefix(aNameIm)+PostPlan + ".tif";
if (EAMIsInit(&KeyCalcMasq))
//.........这里部分代码省略.........
示例9: 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;
}
示例10: ElImScroller
BiScroller::BiScroller
(
VideoWin_Visu_ElImScr & aVisu,
ElImScroller * ScrGray,
ElImScroller * ScrCol,
ModeFusion aModeFusion,
Elise_colour * Cols,
INT NbCol,
const std::string & mNameMasq
) :
ElImScroller (aVisu,1,Inf(ScrGray->SzU(),ScrCol?ScrCol->SzU():ScrGray->SzU()),1.0),
mMemGray (1,aVisu.SzW()),
mScrGray ( ScrGray),
mMemCol (1,aVisu.SzW()),
mScrCol (ScrCol),
mModeFusion (aModeFusion),
mVideoVisu (aVisu),
mImGray (mMemGray.Images()[0]),
mDataGray (mImGray.data()),
mImCol (mMemCol.Images()[0]),
mDataCol (mImCol.data()),
mTabRGB (3,NbCol,256),
mDataTabRGB (mTabRGB.data()),
mImR (aVisu.SzW().x,1),
mDataImR (mImR.data()[0]),
mImG (aVisu.SzW().x,1),
mDataImG (mImG.data()[0]),
mImB (aVisu.SzW().x,1),
mDataImB (mImB.data()[0]),
mTr (0.0,0.0),
mIm1Act (true),
mIm2Act (mScrCol!=0),
mImMasq (1,1)
{
mSubScrolls.push_back(mScrGray);
if (mScrCol)
mSubScrolls.push_back(mScrCol);
for (INT iCol = 0; iCol<NbCol ; iCol++)
for (INT iGray=0; iGray < 256; iGray ++)
{
Elise_colour CGray = Elise_colour::gray(iGray/255.0);
Elise_colour CCol = Cols[iCol];
Elise_colour ColMixed = som_pond(CCol,0.3,CGray);
if (iCol == 0)
ColMixed = CGray;
SetRGBEntry(iGray, iCol, ColMixed);
}
if (mNameMasq!="")
{
Tiff_Im aFM = Tiff_Im::UnivConvStd(mNameMasq);
Pt2di aSz = aFM.sz();
mImMasq=Im2D_U_INT1 (aSz.x,aSz.y);
Fonc_Num aFIn = aFM.in();
if (aModeFusion==eModeMasq)
{
aFIn = (aFM.in()!=0);
}
ELISE_COPY(aFM.all_pts(),aFIn,mImMasq.out());
}
/*
REAL DistCible = 60.0;
DistCible /= 255.0;
for (INT iCol = 0; iCol<NbCol ; iCol++)
{
Elise_colour CCol = Cols[iCol];
Elise_colour aGray = Elise_colour::gray(CCol.GrayVal());
REAL dist = ElMax(1e-10,aGray.eucl_dist(CCol));
Elise_colour vAtDit = aGray + (DistCible/dist) * (CCol-aGray);
Elise_colour v0 = vAtDit - Elise_colour::gray(vAtDit.MinRGB());
Elise_colour v1 = vAtDit + Elise_colour::gray(1.0-vAtDit.MaxRGB());
for (INT iGray=0; iGray < 256; iGray ++)
{
REAL GrayLevel = iGray/255.0;
Elise_colour ColMixed = som_pond(v0,1-GrayLevel,v1);
if (iCol == 0)
ColMixed = Elise_colour::gray(GrayLevel);
//.........这里部分代码省略.........
示例11: ConvertIm_main
int ConvertIm_main(int argc,char ** argv)
{
MMD_InitArgcArgv(argc,argv);
Tiff_Im::SetDefTileFile(1000000);
std::string aNameIn ;
INT aReducX=0;
INT aReducY=0;
INT aReducXY=0;
INT aVisu=0;
GenIm::type_el aTypeOut ;
std::string aNameTypeOut ="";
Tiff_Im::PH_INTER_TYPE aPhInterpOut ;
std::string aNamePITOut ="";
std::string PITOut[] = {"RGB","BW"};
std::list<std::string> lOut(PITOut, PITOut + sizeof(PITOut) / sizeof(std::string) );
std::string aNameOut;
std::string anExt;
Pt2di aP0(0,0);
Pt2di aSzOut ;
Pt2di aSzTF(-1,-1);
REAL aDyn=1.0;
Pt2di aSzTileInterne(-1,-1);
int aKCh = -1;
std::vector<int> aVPermut;
int aNoTile = 0;
std::string aF2 ="";
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aNameIn, "Image", eSAM_IsExistFile),
LArgMain() << EAM(aNameOut,"Out",true)
<< EAM(anExt,"Ext",true)
<< EAM(aSzOut,"SzOut",true, "Size out", eSAM_NoInit)
<< EAM(aP0,"P0",true)
<< EAM(aNameTypeOut,"Type",true, "TypeMNT", eSAM_None, ListOfVal(GenIm::bits1_msbf, ""))
<< EAM(aNamePITOut,"Col",true, "Col", eSAM_None,lOut)
<< EAM(aReducXY,"ReducXY",true)
<< EAM(aReducX,"ReducX",true)
<< EAM(aReducY,"ReducY",true)
<< EAM(aVisu,"Visu",true)
<< EAM(aSzTF,"SzTifTile",true)
<< EAM(aSzTileInterne,"SzTileInterne",true)
<< EAM(aDyn,"Dyn",true)
<< EAM(aKCh,"KCh",true)
<< EAM(aNoTile,"NoTile",true)
<< EAM(aVPermut,"Permut",true, "Permut", eSAM_NoInit)
<< EAM(aF2,"F2",true)
);
if (!MMVisualMode)
{
// Tiff_Im aTifIn = Tiff_Im::BasicConvStd(aNameIn);
Tiff_Im aTifIn = Tiff_Im::UnivConvStd(aNameIn);
INT aNbChIn = aTifIn.nb_chan();
if (! EAMIsInit(&aTypeOut)) aTypeOut =aTifIn.type_el();
if (! EAMIsInit(&aPhInterpOut)) aPhInterpOut = aTifIn.phot_interp();
if (! EAMIsInit(&aSzOut)) aSzOut = aTifIn.sz();
if (aReducXY)
{
aReducX = 1;
aReducY = 1;
}
if (aNameOut=="")
{
if (anExt=="")
{
if (aReducX && aReducY)
anExt = "_RXY";
else if (aReducX)
anExt = "_RX";
else if (aReducY)
anExt = "_RY";
else
anExt= "_Out";
}
if (IsPostfixed(aNameIn))
aNameOut = StdPrefix(aNameIn) + anExt +"." + StdPostfix(aNameIn);
else
aNameOut = aNameIn + anExt + "tif";
}
Pt2di aCoefReduc(aReducX != 0 ? 2 : 1, aReducY != 0 ? 2 : 1);
aSzOut = aSzOut.dcbyc(aCoefReduc);
if (aNameTypeOut != "")
//.........这里部分代码省略.........
示例12: GrShade_main
//.........这里部分代码省略.........
<< EAM(aNbIterMed,"NbIterMed",true)
<< EAM(aTetaH,"TetaH",true)
<< EAM(anAzimut,"Azimut",true)
);
if (!MMVisualMode)
{
double aPdsDef = aVPdsFiltre.size() ? 0 : 1;
for (int aK=aVPdsFiltre.size() ; aK<4 ; aK++)
aVPdsFiltre.push_back(aPdsDef);
double aSPdsF = 0;
for (int aK=0 ; aK<4 ; aK++)
aSPdsF += aVPdsFiltre[aK];
for (int aK=0 ; aK<4 ; aK++)
aVPdsFiltre[aK] /= aSPdsF;
std::string aDir,aNameFileIn;
SplitDirAndFile(aDir,aNameFileIn,aNameIn);
bool WithHypso = (aHypsoDyn>0) || (aNameCol != "");
// bool WithCol = (aNameCol != "");
if (aNameOut=="")
aNameOut = StdPrefix(aNameIn) +std::string("Shade.tif");
Tiff_Im aFileIn = Tiff_Im::StdConvGen(aNameIn,1,true,false);
if (aSzGlob== Pt2di(0,0))
aSzGlob = aFileIn.sz() -aP0Glob;
Fonc_Num aFIn = aFileIn.in_gen(Tiff_Im::eModeCoulGray,Tiff_Im::eModeNoProl);
{
Tiff_Im
(
aNameOut.c_str(),
aSzGlob,
GenIm::u_int1,
Tiff_Im::No_Compr,
WithHypso ? Tiff_Im::RGB : Tiff_Im::BlackIsZero
);
}
Tiff_Im aTifOut(aNameOut.c_str());
if (aSzMaxDalles.x<0) aSzMaxDalles = aSzGlob;
Pt2di aPRD(aSzRecDalles,aSzRecDalles);
cDecoupageInterv2D aDecoup
(
Box2di(aP0Glob,aP0Glob+aSzGlob),
aSzMaxDalles,
Box2di(-aPRD,aPRD)
);
Im2DGen aMnt = AllocImGen(aDecoup.SzMaxIn(),aTMNt);
Im2DGen aShade = AllocImGen(aDecoup.SzMaxIn(),aTShade);
cout << "SZ Max In " << aDecoup.SzMaxIn() << endl;
REAL aRatio = ElMin(800.0/aSzGlob.x,700.0/aSzGlob.y);
Video_Win * pW = aVisu ?
Video_Win::PtrWStd(Pt2di(Pt2dr(aSzGlob)*aRatio)) :
0 ;
示例13: 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;
//.........这里部分代码省略.........
示例14: HomFilterMasq_main
int HomFilterMasq_main(int argc,char ** argv)
{
// MemoArg(argc,argv);
MMD_InitArgcArgv(argc,argv);
std::string aDir,aPat,aFullDir;
bool ExpTxt=false;
std::string PostPlan="_Masq";
std::string KeyCalcMasq;
std::string KeyEquivNoMasq;
std::string MasqGlob;
double aResol=10;
bool AcceptNoMask;
std::string aPostIn= "";
std::string aPostOut= "MasqFiltered";
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aFullDir,"Full name (Dir+Pat)", eSAM_IsPatFile),
LArgMain()
<< EAM(PostPlan,"PostPlan",true,"Post to plan, Def : toto ->toto_Masq.tif like with SaisieMasq")
<< EAM(MasqGlob,"GlobalMasq",true,"Global Masq to add to all image")
<< EAM(KeyCalcMasq,"KeyCalculMasq",true,"For tuning masq per image")
<< EAM(KeyEquivNoMasq,"KeyEquivNoMasq",true,"When given if KENM(i1)==KENM(i2), don't masq")
<< EAM(aResol,"Resol",true,"Sub Resolution for masq storing, Def=10")
<< EAM(AcceptNoMask,"ANM",true,"Accept no mask, def = true if MasqGlob and false else")
<< EAM(ExpTxt,"ExpTxt",true,"Ascii format for in and out, def=false")
<< EAM(aPostIn,"PostIn",true,"Post for Input dir Hom, Def=")
<< EAM(aPostOut,"PostOut",true,"Post for Output dir Hom, Def=MasqFiltered")
);
#if (ELISE_windows)
replace( aFullDir.begin(), aFullDir.end(), '\\', '/' );
#endif
SplitDirAndFile(aDir,aPat,aFullDir);
if (EAMIsInit(&PostPlan))
{
CorrecNameMasq(aDir,aPat,PostPlan);
}
if (!EAMIsInit(&AcceptNoMask))
AcceptNoMask = EAMIsInit(&MasqGlob);
cInterfChantierNameManipulateur * anICNM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
Im2D_Bits<1> aImMasqGlob(1,1);
if (EAMIsInit(&MasqGlob))
aImMasqGlob = GetMasqSubResol(aDir+MasqGlob,aResol);
const std::vector<std::string> * aVN = anICNM->Get(aPat);
std::vector<Im2D_Bits<1> > aVMasq;
for (int aKN = 0 ; aKN<int(aVN->size()) ; aKN++)
{
std::string aNameIm = (*aVN)[aKN];
Tiff_Im aTF = Tiff_Im::StdConvGen(aNameIm,1,false);
Pt2di aSzG = aTF.sz();
Pt2di aSzR (round_ni(Pt2dr(aSzG)/aResol));
Im2D_Bits<1> aImMasq(aSzR.x,aSzR.y,1);
std::string aNameMasq = StdPrefix(aNameIm)+PostPlan + ".tif";
if (EAMIsInit(&KeyCalcMasq))
{
aNameMasq = anICNM->Assoc1To1(KeyCalcMasq,aNameIm,true);
}
if (ELISE_fp::exist_file(aNameMasq))
{
Im2D_Bits<1> aImMasqLoc = GetMasqSubResol(aDir+aNameMasq,aResol);
ELISE_COPY(aImMasq.all_pts(),aImMasq.in() && aImMasqLoc.in(0),aImMasq.out());
}
else
{
if (!AcceptNoMask)
{
std::cout << "For Im " << aNameIm << " file " << aNameMasq << " does not exist\n";
ELISE_ASSERT(false,"Masq not found");
}
}
if (EAMIsInit(&MasqGlob))
{
ELISE_COPY(aImMasq.all_pts(),aImMasq.in() && aImMasqGlob.in(0),aImMasq.out());
}
aVMasq.push_back(aImMasq);
// Tiff_Im::CreateFromIm(aImMasq,"SousRes"+aNameMasq);
}
std::string anExt = ExpTxt ? "txt" : "dat";
//.........这里部分代码省略.........
示例15: SaisieAppuisPredic
void SaisieAppuisPredic(int argc, char ** argv,
Pt2di &aSzW,
Pt2di &aNbFen,
std::string &aFullName,
std::string &aDir,
std::string &aName,
std::string &aNamePt,
std::string &anOri,
std::string &aModeOri,
std::string &aNameMesure,
std::string &aTypePts,
std::string &aMasq3D,
std::string &PIMsFilter,
double &aFlou,
bool &aForceGray,
double &aZMoy,
double &aZInc,
std::string & aInputSec)
{
MMD_InitArgcArgv(argc,argv);
ElInitArgMain
(
argc,argv,
LArgMain() << EAMC(aFullName,"Full Name (Dir+Pattern)", eSAM_IsPatFile)
<< EAMC(anOri,"Orientation", eSAM_IsExistDirOri)
<< EAMC(aNamePt,"File for Ground Control Points", eSAM_IsExistFile)
<< EAMC(aNameMesure,"File for Image Measurements", eSAM_IsExistFile),
LArgMain() << EAM(aSzW,"SzW",true,"Size of global window (Def 800 800)")
<< EAM(aNbFen,"NbF",true,"Number of Sub Window (Def 2 2)")
<< EAM(aFlou,"WBlur",true,"Size IN GROUND GEOMETRY of bluring for target")
<< EAM(aTypePts,"Type",true,"in [MaxLoc,MinLoc,GeoCube]")
<< EAM(aForceGray,"ForceGray",true,"Force gray image, def=true")
<< EAM(aModeOri,"OriMode", true, "Orientation type (GRID) (Def=Std)")
<< EAM(aZMoy,"ZMoy",true,"Average Z, Mandatory in PB", eSAM_NoInit)
<< EAM(aZInc,"ZInc",true,"Incertitude on Z, Mandatory in PB", eSAM_NoInit)
<< EAM(aMasq3D,"Masq3D",true,"3D Masq used for visibility", eSAM_NoInit)
<< EAM(PIMsFilter,"PIMsF",true,"PIMs filter used for visibility", eSAM_NoInit)
<< EAM(aInputSec,"InputSec",true,"PIMs filter used for visibility", eSAM_NoInit)
);
if (!MMVisualMode)
{
aTypePts = "eNSM_" + aTypePts;
SplitDirAndFile(aDir,aName,aFullName);
cInterfChantierNameManipulateur * aCINM = cInterfChantierNameManipulateur::BasicAlloc(aDir);
aCINM->CorrecNameOrient(anOri);
const cInterfChantierNameManipulateur::tSet * aSet = aCINM->Get(aName);
//std::cout << "Nb Image =" << aSet->size() << "\n";
ELISE_ASSERT(aSet->size()!=0,"No image found");
if (aNbFen.x<0)
{
if (aSet->size() == 1)
{
aNbFen = Pt2di(1,2);
}
else if (aSet->size() == 2)
{
Tiff_Im aTF = Tiff_Im::StdConvGen(aDir+(*aSet)[0],1,false,true);
Pt2di aSzIm = aTF.sz();
aNbFen = (aSzIm.x>aSzIm.y) ? Pt2di(1,2) : Pt2di(2,1);
}
else
{
aNbFen = Pt2di(2,2);
}
}
aCINM->MakeStdOrient(anOri,false);
}
}