Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/micmacIGN/micmac
Browse files Browse the repository at this point in the history
  • Loading branch information
erupnik committed Mar 15, 2018
2 parents 344f324 + 5938966 commit ace04f0
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/uti_image/ImVis/Vino_Geom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void cAppli_Vino::ShowSPC(const Pt2dr & aPClW)
std::cout << "\n";

{
Im2D_INT1 aImLogT = aNearest->ImRad();
Im2D_INT1 aImLogT = aNearest->ImLogPol();
int aZoom=10;
Pt2di aSz = aImLogT.sz();

Expand Down
75 changes: 65 additions & 10 deletions src/uti_image/NewRechPH/NH_InvarRad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ Header-MicMac-eLiSe-25/06/2007*/

#include "NewRechPH.h"

Pt2di cAppli_NewRechPH::SzInvRad()
Pt2di cAppli_NewRechPH::SzInvRadUse()
{
return Pt2di(mNbSR, mNbTetaInv);
return Pt2di(mNbSR2Use, mNbTetaInv);
}

Pt2di cAppli_NewRechPH::SzInvRadCalc()
{
return Pt2di(mNbSR2Calc, mNbTetaInv);
}

/*
Expand Down Expand Up @@ -169,6 +174,23 @@ class cRadInvStat
double mS3;
};

// return Pt2di(mNbSR2Use, mNbTetaInv);
void Normalise(tImNRPH aImBuf,tImNRPH aImOut,int aX0In,int aX1In,int aSzXOut)
{
int aSzY = aImBuf.sz().y;
double aS0,aS1,aS2;
ELISE_COPY
(
rectangle(Pt2di(aX0In,0),Pt2di(aX1In,aSzY)),
Virgule(1,aImBuf.in(),Square(aImBuf.in())),
Virgule(sigma(aS0),sigma(aS1),sigma(aS2))
);
aS1 /= aS0;
aS2 /= aS0;
aS2 -= ElSquare(aS1);
aS2 = sqrt(ElMax(1e-10,aS2));
ELISE_COPY(rectangle(Pt2di(aX0In,0),Pt2di(aX0In+aSzXOut,aSzY)),(aImBuf.in()-aS1)/aS2, aImBuf.out());
}


bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
Expand All @@ -182,7 +204,7 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
}

// Buf[KTeta][KRho] pour KRho=0, duplication de la valeur centrale
tImNRPH aImBuf(SzInvRad().x,SzInvRad().y);
tImNRPH aImBuf(SzInvRadCalc().x,SzInvRadCalc().y);
tTImNRPH aTBuf(aImBuf);

std::vector<cOneScaleImRechPH *> aVIm;
Expand All @@ -194,7 +216,7 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)

int aN0 = aPt.NivScale();
// aVIm.push_back(mVI1.at(aN0));
for (int aKRho=0 ; aKRho <mNbSR ; aKRho++)
for (int aKRho=0 ; aKRho <mNbSR2Calc ; aKRho++)
{
aVIm.push_back(mVI1.at(aN0 + aKRho * mDeltaSR));
}
Expand Down Expand Up @@ -238,6 +260,36 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
}
}

// Normalisation a priori, pour l'instant sans rolling
if (mRollNorm)
{
for (int aX= 0 ; aX<mNbSR2Use ; aX++)
{
Normalise(aImBuf,aImBuf,aX,aX+mNbSR2Use,1);
}
}
else
{
Normalise(aImBuf,aImBuf,0,mNbSR2Use,mNbSR2Use);
}

/*
{
double aS0,aS1,aS2;
ELISE_COPY
(
rectangle(Pt2di(0,0),SzInvRadUse()),
Virgule(1,aImBuf.in(),Square(aImBuf.in())),
Virgule(sigma(aS0),sigma(aS1),sigma(aS2))
);
aS1 /= aS0;
aS2 /= aS0;
aS2 -= ElSquare(aS1);
aS2 = sqrt(ElMax(1e-10,aS2));
ELISE_COPY(aImBuf.all_pts(),(aImBuf.in()-aS1)/aS2, aImBuf.out());
}
*/

if (BUG)
{
std::cout << "PTBBUGGGGG 111\n";
Expand All @@ -247,7 +299,7 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
int aKPS2 = mNbTetaInv /4 ;
int aKPi = mNbTetaInv /2 ;
int aNbGrand = ((int) eTIR_NoLabel) / 3;
for (int aKRho=0 ; aKRho<int(aVIm.size()) ; aKRho++)
for (int aKRho=0 ; aKRho<mNbSR2Use ; aKRho++)
{
double aRealDTeta = aVDeltaRad[aKRho] / aVDeltaTang[aKRho];
int aDTeta = round_ni(aRealDTeta); // Delta correspondant a 1 rho
Expand Down Expand Up @@ -340,11 +392,11 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
std::string aName= aDir + "InvRad" + aNamePt + ".tif";

L_Arg_Opt_Tiff aLarg;
aLarg = aLarg + Arg_Tiff(Tiff_Im::AStrip( arrondi_sup(SzInvRad().x,8)));
aLarg = aLarg + Arg_Tiff(Tiff_Im::AStrip( arrondi_sup(SzInvRadCalc().x,8)));
Tiff_Im aSaveBuf
(
aName.c_str(),
SzInvRad(),
SzInvRadCalc(),
GenIm::real4,
Tiff_Im::No_Compr,
Tiff_Im::BlackIsZero,
Expand All @@ -357,10 +409,11 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)

// Pour l'export xml
{
/*
double aS0,aS1,aS2;
ELISE_COPY
(
aImBuf.all_pts(),
rectangle(Pt2di(0,0),SzInvRadUse()),
Virgule(1,aImBuf.in(),Square(aImBuf.in())),
Virgule(sigma(aS0),sigma(aS1),sigma(aS2))
);
Expand All @@ -369,8 +422,10 @@ bool cAppli_NewRechPH::CalvInvariantRot(cOnePCarac & aPt)
aS2 -= ElSquare(aS1);
aS2 = sqrt(ElMax(1e-10,aS2));
ELISE_COPY(aImBuf.all_pts(),(aImBuf.in()-aS1)/aS2, aImBuf.out());
aPt.ImRad() = Im2D_INT1(aImBuf.sz().x,aImBuf.sz().y);
ELISE_COPY(aImBuf.all_pts(),Max(-128,Min(127,round_ni(aImBuf.in()*32))),aPt.ImRad().out());
*/

aPt.ImLogPol() = Im2D_INT1(SzInvRadUse().x,SzInvRadUse().y);
ELISE_COPY(aPt.ImLogPol().all_pts(),Max(-128,Min(127,round_ni(aImBuf.in()*32))),aPt.ImLogPol().out());
aPt.VectRho() = aVRho;

if (BUG)
Expand Down
8 changes: 6 additions & 2 deletions src/uti_image/NewRechPH/NewRechPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ cAppli_NewRechPH::cAppli_NewRechPH(int argc,char ** argv,bool ModeTest) :
mNbS (30),
mISF (-1,1e10),
mStepSR (1.0),
mNbSR (10),
mNbSR2Use (10),
mDeltaSR (1),
mMaxLevR (mNbS - (mNbSR-1) * mDeltaSR),
mRollNorm (true),
mNbTetaIm (16),
mMulNbTetaInv (4),
mNbTetaInv (mNbTetaIm*mMulNbTetaInv),
Expand Down Expand Up @@ -202,6 +202,10 @@ cAppli_NewRechPH::cAppli_NewRechPH(int argc,char ** argv,bool ModeTest) :
<< EAM(mISF, "ISF",true,"Interval scale forced")
);

mNbSR2Calc = mRollNorm ? (mNbSR2Use * 2 - 1) : mNbSR2Use;
mMaxLevR = mNbS - (mNbSR2Calc-1) * mDeltaSR;


if (! EAMIsInit(&mExtSave))
{
mExtSave = mBasic ? "Basic" : "Std";
Expand Down
7 changes: 5 additions & 2 deletions src/uti_image/NewRechPH/NewRechPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ class cOneScaleImRechPH
class cAppli_NewRechPH
{
public :
Pt2di SzInvRad();
Pt2di SzInvRadUse();
Pt2di SzInvRadCalc();

cAppli_NewRechPH(int argc,char ** argv,bool ModeTest);

Expand Down Expand Up @@ -221,7 +222,9 @@ class cAppli_NewRechPH
Invariant Rotation
*/
double mStepSR; // Pas entre les pixel de reechantillonage pour les desc
int mNbSR; // Nbre de niveau radial (entre
bool mRollNorm; // si true , normalisation par fenetre glissante, :
int mNbSR2Use; // Nbre de niveau pour utilisation
int mNbSR2Calc; // Nbre de niveau a calculer, different si rolling
int mDeltaSR; // Delta entre deux niveau radiaux, genre 1 ou 2 ?
int mMaxLevR; // Niv max permettant le calcul (calcule a partir des autres)

Expand Down
11 changes: 10 additions & 1 deletion src/uti_image/NewRechPH/ParamNewRechPH.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@
<!-- Code Binaire : devrait etre 1D, mais flemme modifier xml_init et autres ... -->
<CodeBinaire Nb="1" Type="Im2D_U_INT2"> </CodeBinaire>
</OneInvRad>

<ProfilRad Nb="1" Class="true" ToReference="true">
<!-- y : NumVect , x : Rho -->
<ImProfil Nb="1" Type="Im2D_INT1"> </ImProfil>
<!-- Code Binaire : devrait etre 1D, mais flemme modifier xml_init et autres ... -->
</OneInvRad>


<OnePCarac Nb="1" Class="true" ToReference="true">
<Kind Nb="1" Type="eTypePtRemark"> </Kind>
<Pt Nb="1" Type="Pt2dr"> </Pt>
Expand All @@ -105,8 +113,9 @@
<!-- codage binaire -->
<!-- Pour visu -->
<InvR Nb="1" RefType="OneInvRad"> </InvR>
<ImRad Nb="1" Type="Im2D_INT1"> </ImRad>
<ImLogPol Nb="1" Type="Im2D_INT1"> </ImLogPol>
<VectRho Nb="1" Type="std::vector<double>"> </VectRho>
<ProfR Nb="1" RefType="ProfilRad"> </ProfR>
</OnePCarac>

<SetPCarac Nb="1" Class="true">
Expand Down
11 changes: 7 additions & 4 deletions src/uti_image/NewRechPH/StatPHom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ void cOneImSPH::TestMatch(cOneImSPH & aI2)
if ((!aV1.empty()) && (!aV2.empty()))
{
aI2.mVNearest.clear();
std::cout << "===========================================================\n";
std::cout << "*************===========================================================*************\n";
std::cout << "*************===========================================================*************\n";
std::cout << "*************===========================================================*************\n";
std::cout << "For " << eToString(aLab) << " sz=" << aV1.size() << " " << aV2.size() << "\n";

std::vector<double> aVD22;
Expand All @@ -190,7 +192,7 @@ void cOneImSPH::TestMatch(cOneImSPH & aI2)
aI2.mVNearest.push_back(aP);
aVD22.push_back(aDist);
}
mAppli.ShowStat("Nearest D for ",20,aVD22);
mAppli.ShowStat("Distribution du point le plus proche avec meme carac",20,aVD22);


std::vector<double> aVD12;
Expand Down Expand Up @@ -336,8 +338,9 @@ void cAppliStatPHom::TestHom()
}
}
}
ShowStat("ECAR EPIP",20,aVREpi);
ShowStat("ECAR COMPL",20,aVRComp);
// La, on test la qualite des references , epipolaire et nuages
ShowStat("ECAR EPIP pour les points SIFT",20,aVREpi);
ShowStat("ECAR COMPLET pour les points SIFT",20,aVRComp);
/*
int aNB= 20;
std::cout << "========= ECAR EPIP ==========\n";
Expand Down
24 changes: 12 additions & 12 deletions src/uti_image/NewRechPH/cParamNewRechPH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ const cOneInvRad & cOnePCarac::InvR()const
}


Im2D_INT1 & cOnePCarac::ImRad()
Im2D_INT1 & cOnePCarac::ImLogPol()
{
return mImRad;
return mImLogPol;
}

const Im2D_INT1 & cOnePCarac::ImRad()const
const Im2D_INT1 & cOnePCarac::ImLogPol()const
{
return mImRad;
return mImLogPol;
}


Expand Down Expand Up @@ -545,7 +545,7 @@ void BinaryUnDumpFromFile(cOnePCarac & anObj,ELISE_fp & aFp)
BinaryUnDumpFromFile(anObj.AutoCorrel(),aFp);
BinaryUnDumpFromFile(anObj.OK(),aFp);
BinaryUnDumpFromFile(anObj.InvR(),aFp);
BinaryUnDumpFromFile(anObj.ImRad(),aFp);
BinaryUnDumpFromFile(anObj.ImLogPol(),aFp);
BinaryUnDumpFromFile(anObj.VectRho(),aFp);
}

Expand All @@ -565,7 +565,7 @@ void BinaryDumpInFile(ELISE_fp & aFp,const cOnePCarac & anObj)
BinaryDumpInFile(aFp,anObj.AutoCorrel());
BinaryDumpInFile(aFp,anObj.OK());
BinaryDumpInFile(aFp,anObj.InvR());
BinaryDumpInFile(aFp,anObj.ImRad());
BinaryDumpInFile(aFp,anObj.ImLogPol());
BinaryDumpInFile(aFp,anObj.VectRho());
}

Expand All @@ -587,7 +587,7 @@ cElXMLTree * ToXMLTree(const cOnePCarac & anObj)
aRes->AddFils(::ToXMLTree(std::string("AutoCorrel"),anObj.AutoCorrel())->ReTagThis("AutoCorrel"));
aRes->AddFils(::ToXMLTree(std::string("OK"),anObj.OK())->ReTagThis("OK"));
aRes->AddFils(ToXMLTree(anObj.InvR())->ReTagThis("InvR"));
aRes->AddFils(::ToXMLTree(std::string("ImRad"),anObj.ImRad())->ReTagThis("ImRad"));
aRes->AddFils(::ToXMLTree(std::string("ImLogPol"),anObj.ImLogPol())->ReTagThis("ImLogPol"));
aRes->AddFils(::ToXMLTree(std::string("VectRho"),anObj.VectRho())->ReTagThis("VectRho"));
aRes->mGXml = anObj.mGXml;
XMLPopContext(anObj.mGXml);
Expand Down Expand Up @@ -627,12 +627,12 @@ void xml_init(cOnePCarac & anObj,cElXMLTree * aTree)

xml_init(anObj.InvR(),aTree->Get("InvR",1)); //tototo

xml_init(anObj.ImRad(),aTree->Get("ImRad",1)); //tototo
xml_init(anObj.ImLogPol(),aTree->Get("ImLogPol",1)); //tototo

xml_init(anObj.VectRho(),aTree->Get("VectRho",1)); //tototo
}

std::string Mangling( cOnePCarac *) {return "A1E622235CA23AC9FD3F";};
std::string Mangling( cOnePCarac *) {return "E0CF3BC532583685FE3F";};


std::vector< cOnePCarac > & cSetPCarac::OnePCarac()
Expand Down Expand Up @@ -691,7 +691,7 @@ void xml_init(cSetPCarac & anObj,cElXMLTree * aTree)
xml_init(anObj.OnePCarac(),aTree->GetAll("OnePCarac",false,1));
}

std::string Mangling( cSetPCarac *) {return "00FB91C136438280FE3F";};
std::string Mangling( cSetPCarac *) {return "55544900B54811F1FE3F";};


cOnePCarac & cSRPC_Truth::P1()
Expand Down Expand Up @@ -748,7 +748,7 @@ void xml_init(cSRPC_Truth & anObj,cElXMLTree * aTree)
xml_init(anObj.P2(),aTree->Get("P2",1)); //tototo
}

std::string Mangling( cSRPC_Truth *) {return "208C32A1E44ECED3FBBF";};
std::string Mangling( cSRPC_Truth *) {return "605FA27E9728E3ABFBBF";};


std::vector< cSRPC_Truth > & cSetRefPCarac::SRPC_Truth()
Expand Down Expand Up @@ -841,7 +841,7 @@ void xml_init(cSetRefPCarac & anObj,cElXMLTree * aTree)
xml_init(anObj.SRPC_Rand(),aTree->GetAll("SRPC_Rand",false,1));
}

std::string Mangling( cSetRefPCarac *) {return "86C0DAE397FC78B5FD3F";};
std::string Mangling( cSetRefPCarac *) {return "D1AF655A5B3CE59CFE3F";};


std::vector<double> & cCBOneBit::Coeff()
Expand Down
6 changes: 3 additions & 3 deletions src/uti_image/NewRechPH/cParamNewRechPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class cOnePCarac
cOneInvRad & InvR();
const cOneInvRad & InvR()const ;

Im2D_INT1 & ImRad();
const Im2D_INT1 & ImRad()const ;
Im2D_INT1 & ImLogPol();
const Im2D_INT1 & ImLogPol()const ;

std::vector<double> & VectRho();
const std::vector<double> & VectRho()const ;
Expand All @@ -199,7 +199,7 @@ class cOnePCarac
double mAutoCorrel;
bool mOK;
cOneInvRad mInvR;
Im2D_INT1 mImRad;
Im2D_INT1 mImLogPol;
std::vector<double> mVectRho;
};
cElXMLTree * ToXMLTree(const cOnePCarac &);
Expand Down
Loading

0 comments on commit ace04f0

Please sign in to comment.