Skip to content

Commit 920c057

Browse files
author
deseilligny
committed
In Add Clino to block
1 parent 375d704 commit 920c057

File tree

10 files changed

+455
-123
lines changed

10 files changed

+455
-123
lines changed

MMVII/MMVII-UseCaseDataSet/Tests/Cmd-NewBlock.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# MMVII OriBundleAdj Im-Calib_OK_Resec.xml Pannel_BA1_311 Pannel_BA2_311 "GCP3D=[[Pannel,1]]" "GCP2D=[[Pannel,0.1,0.2,1,2]]"
22

3+
set -e
4+
35
MMVII BlockInstrEdit BL0 "PatsIm4Cam=[Im-Calib.xml,.*_(.*).tif]" # InMeasureClino=MesClinFilA_043
46
MMVII BlockInstrEdit BL0 InMeasureClino=MesClinFilA_043
57
MMVII BlockInstrEdit BL0 CRO=[[A1,A2,1e-6,i-kj]]
@@ -13,8 +15,10 @@ MMVII BlockInstrInitCam Im-Calib_OK_Resec.xml BL0 Pannel_BA2_311 BL1
1315
MMVII OriBundleAdj Im-Calib_OK_Resec.xml Pannel_BA2_311 Pannel_BA3_311 "GCP3D=[[Pannel,1]]" "GCP2D=[[Pannel,0.1,0.2,1,2]]" InInstrBlock=BL1 OutInstrBlock=BL2 BOI=[[,0.01,0.01,1],[]] NbIter=10
1416

1517

18+
#MMVII BlockInstrInitClino Im-Calib_OK_Resec.xml BL2 Pannel_BA3_311
19+
1620

17-
MMVII BlockInstrEdit BL2 InMeasureClino=MesClinFilA_043 OutInstrBlock=BL3
21+
#MMVII BlockInstrEdit BL2 InMeasureClino=MesClinFilA_043 OutInstrBlock=BL3
1822

1923

2024

MMVII/include/MMVII_DeclareAllCmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extern cSpecMMVII_Appli TheSpecEditRel;
1919
extern cSpecMMVII_Appli TheSpec_EditCalcMetaDataImage;
2020
extern cSpecMMVII_Appli TheSpec_EditBlockInstr;
2121
extern cSpecMMVII_Appli TheSpec_BlockInstrInitCam;
22+
extern cSpecMMVII_Appli TheSpec_BlockInstrInitClino;
2223
extern cSpecMMVII_Appli TheSpec_BlockInstrReport;
2324
extern cSpecMMVII_Appli TheSpecWalkman;
2425
extern cSpecMMVII_Appli TheSpecDaisy;

MMVII/include/MMVII_InstrumentalBlock.h

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class cAppli_BlockInstrInitCam; // appli for computing initial value of poses in
7777
/* ============ Classes for camera calibration ====================== */
7878

7979
/// class for representing one camera embeded in a "Rigid Block of Instrument"
80-
class cIrbCal_Cam1 // : public cMemCheck
80+
class cIrbCal_Cam1 : public cMemCheck
8181
{
8282
public :
8383
cIrbCal_Cam1(); //< required for serialisation
@@ -120,7 +120,7 @@ void AddData(const cAuxAr2007 & anAux,cIrbCal_Cam1 & aCam);
120120

121121

122122
/// class for representing the set of cameras embedded in a bloc
123-
class cIrbCal_CamSet //: public cMemCheck
123+
class cIrbCal_CamSet : public cMemCheck
124124
{
125125
public :
126126
friend cAppli_EditBlockInstr;
@@ -161,7 +161,7 @@ void AddData(const cAuxAr2007 & anAux,cIrbCal_CamSet & aCam);
161161
/* ============ Classes for clinometers calibration ====================== */
162162

163163
/// class for representing one clino embeded in a "Rigid Block of Instrument""
164-
class cIrbCal_Clino1 // : public cMemCheck
164+
class cIrbCal_Clino1 : public cMemCheck
165165
{
166166
public :
167167
cIrbCal_Clino1(); //< required for serialisation
@@ -177,14 +177,15 @@ class cIrbCal_Clino1 // : public cMemCheck
177177
void AddData(const cAuxAr2007 & anAux,cIrbCal_Clino1 & aClino);
178178

179179
/// class for representing a set of clino
180-
class cIrbCal_ClinoSet // : public cMemCheck
180+
class cIrbCal_ClinoSet : public cMemCheck
181181
{
182182
public :
183183
friend cIrbCal_Block;
184184
friend cAppli_EditBlockInstr;
185185

186186
cIrbCal_ClinoSet();
187187
void AddData(const cAuxAr2007 & anAux);
188+
std::vector<std::string> VNames() const;
188189
private :
189190
cIrbCal_Clino1 * ClinoFromName(const std::string& aName);
190191
void AddClino(const std::string &,bool SVP=false);
@@ -193,6 +194,8 @@ class cIrbCal_ClinoSet // : public cMemCheck
193194
cIrbCal_Block * mCalBlock;
194195

195196
};
197+
void AddData(const cAuxAr2007 & anAux,cIrbCal_ClinoSet & aClino);
198+
196199

197200
/// class for storing a relative orientation extern constraint ( for ex orthoganility of clino) between 2 instrument
198201

@@ -253,12 +256,12 @@ class cIrb_Desc1Intsr
253256

254257
void AddData(const cAuxAr2007 & anAux);
255258
void AddNewSigma (const cIrb_SigmaInstr&);
256-
const cIrb_SigmaInstr & Sigma() const;
257259
void SetSigma(const cIrb_SigmaInstr&);
260+
void ResetSigma();
258261

259-
260-
eTyInstr Type() const;
261-
const std::string & NameInstr() const;
262+
const cIrb_SigmaInstr & Sigma() const; //< Accessor
263+
eTyInstr Type() const; //< Accessor
264+
const std::string & NameInstr() const; //< Accessor
262265

263266
private :
264267
eTyInstr mType;
@@ -270,7 +273,7 @@ void AddData(const cAuxAr2007 & anAux,cIrb_Desc1Intsr & aDesc);
270273

271274

272275
/// class for representing the structure/calibration of instruments possibly used
273-
class cIrbCal_Block // : public cMemCheck
276+
class cIrbCal_Block : public cMemCheck
274277
{
275278
public :
276279
friend cIrbComp_Block;
@@ -288,7 +291,11 @@ class cIrbCal_Block // : public cMemCheck
288291

289292
const std::map<tNamePair,cIrb_SigmaInstr> & SigmaPair() const;
290293
void SetSigmaPair( const std::map<tNamePair,cIrb_SigmaInstr> & );
291-
const cIrb_Desc1Intsr & SigmaInd(const std::string &) const;
294+
void SetSigmaIndiv( const std::map<tNamePair,cIrb_SigmaInstr> & );
295+
296+
const cIrb_Desc1Intsr & DescrIndiv(const std::string &) const;
297+
cIrb_Desc1Intsr & NC_DescrIndiv(const std::string &) ;
298+
292299

293300
void AvgPairSigma(); //< Set all sigma of pairs to global average (in the same type)
294301
void AvgIndivSigma(); //< Set all sigma of object ir global average
@@ -311,7 +318,7 @@ class cIrbCal_Block // : public cMemCheck
311318
cIrbCal_ClinoSet mSetClinos; //< Clinos used in the bloc
312319

313320
std::map<tNamePair,cIrb_SigmaInstr> mSigmaPair; //< Sigmas between pair of instr
314-
std::map<std::string,cIrb_Desc1Intsr> mSigmaInd; //< Sigmas of each instrument
321+
std::map<std::string,cIrb_Desc1Intsr> mDescrIndiv; //< Sigmas of each instrument
315322
std::map<tNamePair,cIrb_CstrRelRot> mCstrRelRot;
316323

317324
};
@@ -324,7 +331,7 @@ void AddData(const cAuxAr2007 & anAux,cIrbCal_Block & aRBoI);
324331
/* ************************************************************ */
325332

326333
/// class for storing poses in a cIrbComp_Cam1
327-
class cIrbComp_Cam1 //: public cMemCheck
334+
class cIrbComp_Cam1 : public cMemCheck
328335
{
329336
public :
330337
cIrbComp_Cam1();
@@ -346,7 +353,7 @@ class cIrbComp_Cam1 //: public cMemCheck
346353
cSensorCamPC * mCamPC;
347354
};
348355

349-
class cIrbComp_CamSet // : public cMemCheck
356+
class cIrbComp_CamSet : public cMemCheck
350357
{
351358
public :
352359
friend cIrbComp_Block;
@@ -369,8 +376,27 @@ class cIrbComp_CamSet // : public cMemCheck
369376
std::vector<cIrbComp_Cam1> mVCompPoses;
370377
};
371378

379+
380+
class cIrbComp_Clino1 : public cMemCheck
381+
{
382+
public :
383+
cIrbComp_Clino1(tREAL8 anAngle);
384+
private :
385+
tREAL8 mAngle;
386+
};
387+
388+
class cIrbComp_ClinoSet : public cMemCheck
389+
{
390+
public :
391+
cIrbComp_ClinoSet();
392+
void SetClinoValues(const cOneMesureClino&);
393+
394+
private :
395+
std::vector<cIrbComp_Clino1> mVCompClinos;
396+
};
397+
372398
/// class for storing one time stamp in cIrbComp_Block
373-
class cIrbComp_TimeS //: public cMemCheck
399+
class cIrbComp_TimeS : public cMemCheck
374400
{
375401
public :
376402
friend cIrbComp_Block;
@@ -380,16 +406,27 @@ class cIrbComp_TimeS //: public cMemCheck
380406
cIrbComp_CamSet & SetCams(); //< Accessor
381407

382408
const cIrbComp_Block & CompBlock() const; //< Accessor
409+
const cIrbCal_Block & CalBlock() const; //< Accessor or Accessor
383410
// cIrbComp_Block & CompBlock() ; //< Accessor
411+
412+
// if not SVP and cannot compute : error
413+
void ComputePoseInstrument(bool SVP = false);
414+
void SetClinoValues(const cOneMesureClino&);
415+
384416
private :
385417
cIrbComp_TimeS(const cIrbComp_TimeS&) = delete;
386418
const cIrbComp_Block & mCompBlock;
387419
cIrbComp_CamSet mSetCams;
420+
cIrbComp_ClinoSet mSetClino;
421+
422+
/** Not sure which role will play the notion of "pose of the instrument"*/
423+
bool mPoseInstrIsInit;
424+
tPoseR mPoseInstr;
388425
};
389426

390427
/// class for using a rigid bloc in computation (calibration/compensation)
391428
// cIrbComp_Block
392-
class cIrbComp_Block //: public cMemCheck
429+
class cIrbComp_Block : public cMemCheck
393430
{
394431
public :
395432
typedef std::tuple<tREAL8,tPoseR,cIrb_SigmaInstr> tResCompCal;
@@ -414,6 +451,8 @@ class cIrbComp_Block //: public cMemCheck
414451
const tContTimeS & DataTS() const ; //< Accessor
415452
tContTimeS & DataTS(); //< Accessor
416453

454+
// compute pose of instrument for all time stamp
455+
void ComputePoseInstrument(bool SVP = false);
417456

418457

419458
// Add an image if orientation exist (via PhProj)
@@ -424,6 +463,10 @@ class cIrbComp_Block //: public cMemCheck
424463
// for a given pair K1/K2 the 'best' relative pose and its sigma
425464
tResCompCal ComputeCalibCamsInit(int aK1,int aK2) const;
426465

466+
//
467+
void SetClinoValues(const cSetMeasureClino&,bool OkNewTimeS=false );
468+
/// call previous by using std measure on phproj
469+
void SetClinoValues(bool OkNewTimeS=false);
427470
private :
428471
/// non copiable, too "dangerous"
429472
cIrbComp_Block(const cIrbComp_Block & ) = delete;

MMVII/include/MMVII_enums.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ enum class eApF
8888
SysCo, ///< Coordinate system
8989
BlockInstr, ///< Edit, Calib, block of instrument
9090
Ori, ///< Orientation
91+
Clino,
9192
Match, ///< Dense Matching
9293
GCP, ///< Ground point processing
9394
TieP, ///< Tie-Point processing
@@ -148,6 +149,7 @@ enum class eFormatExtern
148149
enum class eApDT
149150
{
150151
Ori, ///< Orientation
152+
Clino,
151153
PCar, ///< Tie Points
152154
TieP, ///< Tie Points
153155
BlockInstr, ///< Tie Points

MMVII/src/Appli/cSpecMMVII_Appli.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ std::vector<cSpecMMVII_Appli *> & cSpecMMVII_Appli::InternVecAll()
165165
TheVecAll.push_back(&TheSpec_EditBlockInstr);
166166
TheVecAll.push_back(&TheSpec_BlockInstrReport);
167167
TheVecAll.push_back(&TheSpec_BlockInstrInitCam);
168-
169-
168+
TheVecAll.push_back(&TheSpec_BlockInstrInitClino);
170169
TheVecAll.push_back(&TheSpecWalkman);
171170
TheVecAll.push_back(&TheSpecDaisy);
172171
TheVecAll.push_back(&TheSpecCatVideo);

MMVII/src/BundleAdjustment/Adjust_InstrumentalBlock.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ void cBA_BlockInstr::OneItere_1TS(cIrbComp_TimeS& aDataS)
210210
{
211211
for (auto & [aPair,aSigma2] : mCalBl->SigmaPair() )
212212
{
213-
const cIrb_Desc1Intsr & aSI1 = mCalBl->SigmaInd(aPair.V1());
214-
const cIrb_Desc1Intsr & aSI2 = mCalBl->SigmaInd(aPair.V2());
213+
const cIrb_Desc1Intsr & aSI1 = mCalBl->DescrIndiv(aPair.V1());
214+
const cIrb_Desc1Intsr & aSI2 = mCalBl->DescrIndiv(aPair.V2());
215215
if ((aSI1.Type()==eTyInstr::eCamera) && (aSI2.Type()==eTyInstr::eCamera))
216216
{
217217
OneItere_1PairCam(aSigma2,aDataS,aPair);
@@ -248,7 +248,7 @@ void cBA_BlockInstr::AddGauge(bool InEq)
248248

249249
if (InEq)
250250
{
251-
const cIrb_SigmaInstr & aSigma = mCalBl->SigmaInd(mMasterCam.NameCal()).Sigma();
251+
const cIrb_SigmaInstr & aSigma = mCalBl->DescrIndiv(mMasterCam.NameCal()).Sigma();
252252
if (mGaujeTr>0)
253253
Sys().AddEqFixCurVar(aPBl,aC,1.0/Square(mGaujeTr*aSigma.SigmaTr()));
254254
if (mGaujeRot>0)
@@ -273,6 +273,7 @@ void cBA_BlockInstr::SaveSigma()
273273
{
274274
// case we save empirical sigma between pairs
275275
mCalBl->SetSigmaPair(mSigmaPair);
276+
mCalBl->SetSigmaIndiv(mSigmaPair);
276277
}
277278
else
278279
{
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#include "MMVII_InstrumentalBlock.h"
2+
#include "cMMVII_Appli.h"
3+
#include "MMVII_2Include_Serial_Tpl.h"
4+
5+
6+
7+
8+
/**
9+
\file cInstrumentalBloc.cpp
10+
11+
12+
\brief This file contains the core implemantation of Block of rigid instrument
13+
14+
*/
15+
16+
namespace MMVII
17+
{
18+
19+
/* *************************************************************** */
20+
/* */
21+
/* cAppli_BlockInstrInitClino */
22+
/* */
23+
/* *************************************************************** */
24+
25+
class cAppli_BlockInstrInitClino : public cMMVII_Appli
26+
{
27+
public :
28+
29+
cAppli_BlockInstrInitClino(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli &);
30+
cCollecSpecArg2007 & ArgObl(cCollecSpecArg2007 & anArgObl) override;
31+
cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override;
32+
int Exe() override;
33+
// std::vector<std::string> Samples() const ;
34+
35+
private :
36+
cPhotogrammetricProject mPhProj;
37+
std::string mSpecImIn;
38+
cIrbComp_Block * mBlock;
39+
std::string mNameBloc; //< name of the bloc inside the
40+
bool mAvgSigma; //< Do we average sigma of pairs
41+
};
42+
43+
44+
cAppli_BlockInstrInitClino::cAppli_BlockInstrInitClino(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
45+
cMMVII_Appli (aVArgs,aSpec),
46+
mPhProj (*this),
47+
mBlock (nullptr),
48+
mNameBloc (cIrbCal_Block::theDefaultName),
49+
mAvgSigma (true)
50+
{
51+
}
52+
53+
cCollecSpecArg2007 & cAppli_BlockInstrInitClino::ArgObl(cCollecSpecArg2007 & anArgObl)
54+
{
55+
return anArgObl
56+
<< Arg2007(mSpecImIn,"Pattern/file for images", {{eTA2007::MPatFile,"0"},{eTA2007::FileDirProj}} )
57+
<< mPhProj.DPBlockInstr().ArgDirInMand()
58+
<< mPhProj.DPOrient().ArgDirInMand()
59+
<< mPhProj.DPMeasuresClino().ArgDirInMand()
60+
<< mPhProj.DPBlockInstr().ArgDirOutMand()
61+
;
62+
}
63+
64+
cCollecSpecArg2007 & cAppli_BlockInstrInitClino::ArgOpt(cCollecSpecArg2007 & anArgOpt)
65+
{
66+
return anArgOpt
67+
<< AOpt2007(mNameBloc,"NameBloc","Name of bloc to calib ",{{eTA2007::HDV}})
68+
<< AOpt2007(mAvgSigma,"AvgSigma","Do we average the sigma init",{{eTA2007::HDV}})
69+
;
70+
}
71+
72+
int cAppli_BlockInstrInitClino::Exe()
73+
{
74+
mPhProj.FinishInit();
75+
76+
// read an existing bloc from std folder
77+
mBlock = new cIrbComp_Block(mPhProj,mNameBloc);
78+
79+
// add all the camera
80+
for (const auto & aNameIm : VectMainSet(0))
81+
{
82+
mBlock->AddImagePose(aNameIm);
83+
}
84+
85+
mBlock->ComputePoseInstrument();
86+
mBlock->SetClinoValues();
87+
88+
mPhProj.SaveRigBoI(mBlock->CalBlock());
89+
90+
delete mBlock;
91+
92+
return EXIT_SUCCESS;
93+
}
94+
95+
/* ==================================================== */
96+
/* */
97+
/* MMVII */
98+
/* */
99+
/* ==================================================== */
100+
101+
102+
tMMVII_UnikPApli Alloc_BlockInstrInitClino(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec)
103+
{
104+
return tMMVII_UnikPApli(new cAppli_BlockInstrInitClino(aVArgs,aSpec));
105+
}
106+
107+
cSpecMMVII_Appli TheSpec_BlockInstrInitClino
108+
(
109+
"BlockInstrInitClino",
110+
Alloc_BlockInstrInitClino,
111+
"Init camera poses inside a block of instrument",
112+
{eApF::BlockInstr,eApF::Ori,eApF::Clino},
113+
{eApDT::BlockInstr,eApDT::Ori,eApDT::Clino},
114+
{eApDT::BlockInstr},
115+
__FILE__
116+
);
117+
118+
119+
};
120+

0 commit comments

Comments
 (0)