55namespace MMVII
66{
77
8+ class cOneData_L23 ; // < Store data one line 2d->3d
9+ class cCam2_Line_2Dto3D ; // < Compute initial "known" 3d line from 2d obs in camera
10+ class cUK_Line3D_4BA ; // < Adjust unknown 3d line
11+
12+
13+
14+ /* * Store data one line 2d->3d, essentially data */
15+
816class cOneData_L23
917{
1018 public :
19+ // / constructor
1120 cOneData_L23 (cSensorCamPC * ,const tSeg2dr & aSeg,int aKIm);
21+ // / desctructor, free mutable object
1222 ~cOneData_L23 ();
23+ // / create, if dont exist, manifold for distorted line
1324 cLineDist_Manifold* SetAndGet_LineM () const ;
25+ // / create, if dont exist, calculator for line-adjustment
1426 cCalculator<tREAL8> * SetAndGet_CalcEqSeg () const ;
1527
1628
17- cSensorCamPC * mCam ;
18- const tSeg2dr mSeg ;
19- const cPlane3D mPlane ;
20- const int mKIm ;
21- // cBoundVals<tREAL8> mIntAbsc;
29+ cSensorCamPC * mCam ; // < camera seeing the line
30+ const tSeg2dr mSeg ; // < line seen in a camera
31+ const cPlane3D mPlane ; // < 3d plane projecting on the line
32+ const int mKIm ; // < index in a vector (unused 4 now)
2233 private :
2334 mutable cLineDist_Manifold* mLineM ;
2435 mutable cCalculator<tREAL8> * mCalcEqSeg ;
2536};
2637
38+
39+
40+ // / class to handle computation
41+ class cCam2_Line_2Dto3D
42+ {
43+ public :
44+ cCam2_Line_2Dto3D (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject *);
45+
46+ const tSegComp3dr & Seg3d () const ;
47+ const std::string & NameLine () const ;
48+ std::vector<cOneData_L23> Datas_L23 ();
49+ cPt3dr PtOfWeight (const tREAL8 aWeight);
50+
51+ private :
52+ void AssertSeg3dIsInit () const ;
53+
54+ tSegComp3dr mSeg3d ;
55+ bool mSeg3dIsInit ;
56+ std::string mNameLine ;
57+
58+ std::vector<cOneData_L23> mDatas_L23 ;
59+ };
60+
61+
62+
63+ /* * in cUK_Line3D_4BA with put data in a specific class to allow copy (in "OnUpdate"),
64+ * which would be forbiden due to inheritance */
65+
66+
67+ // / class handling a 3D unknown line for bundle adjusment
68+ class cUK_Line3D_4BA : public cObjWithUnkowns <tREAL8>
69+ {
70+ public :
71+ // < constructor,
72+ cUK_Line3D_4BA (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject *,cMMVII_BundleAdj *);
73+
74+ void AddEquation (tREAL8 aSigmaLine,int aNbSampling);
75+ private :
76+ void AddOneEquation (tREAL8 aLambda, tREAL8 aWeight,const cOneData_L23&);
77+ void InitNormals ();
78+
79+ // / "reaction" after linear update
80+ void OnUpdate () override ;
81+ // / method called when the object must indicate its unknowns
82+ void PutUknowsInSetInterval () override ;
83+
84+ cMMVII_BundleAdj* mBA ;
85+ cCam2_Line_2Dto3D mLineInit ;
86+ tSegComp3dr mSeg ;
87+ cPt3dr mNorm_x ; // < the first vector normal
88+ cPt3dr mNorm_y ; // < the second vector normal
89+ cPt2dr_UK mUkN1 ; // < unknown displacement at Seg.P1, coded as "Uk1.x Nx+ Uk1.y Ny"
90+ cPt2dr_UK mUkN2 ; // < unknown displacement at Seg.P2
91+ // cUK_Line3D_4BA_Data mData;
92+ };
93+
94+
95+ /* *********************************************************** */
96+ /* */
97+ /* cOneData_L23 */
98+ /* */
99+ /* *********************************************************** */
100+
101+
27102cOneData_L23::cOneData_L23 (cSensorCamPC * aCam,const tSeg2dr & aSeg,int aKIm) :
28103 mCam (aCam),
29104 mSeg (aSeg),
@@ -53,27 +128,11 @@ cCalculator<tREAL8> * cOneData_L23::SetAndGet_CalcEqSeg() const
53128 return mCalcEqSeg ;
54129}
55130
56-
57- // / class to handle computation
58- class cCam2_Line_2Dto3D
59- {
60- public :
61- cCam2_Line_2Dto3D (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject *);
62-
63- const tSegComp3dr & Seg3d () const ;
64- const std::string & NameLine () const ;
65- std::vector<cOneData_L23> Datas_L23 ();
66- cPt3dr PtOfWeight (const tREAL8 aWeight);
67-
68- private :
69- void AssertSeg3dIsInit () const ;
70-
71- tSegComp3dr mSeg3d ;
72- bool mSeg3dIsInit ;
73- std::string mNameLine ;
74-
75- std::vector<cOneData_L23> mDatas_L23 ;
76- };
131+ /* *********************************************************** */
132+ /* */
133+ /* cCam2_Line_2Dto3D */
134+ /* */
135+ /* *********************************************************** */
77136
78137cCam2_Line_2Dto3D::cCam2_Line_2Dto3D (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject * aPhProj) :
79138 mSeg3d (cPt3dr(0 ,0 ,0 ),cPt3dr(1 ,1 ,1 )),
@@ -145,51 +204,6 @@ const std::string & cCam2_Line_2Dto3D::NameLine() const
145204 return mNameLine ;
146205}
147206
148- /*
149- cPt3dr cCam2_Line_2Dto3D::PtOfWeight(const tREAL8 aWeight)
150- {
151- tREAL8 aAbsc = mIntervAbsc.VMin()*(1-aWeight) + mIntervAbsc.VMax()*aWeight;
152-
153- return mSeg3d.PtOfAbscissa(aAbsc);
154- }
155- */
156-
157-
158- /* * in cUK_Line3D_4BA with put data in a specific class to allow copy (in "OnUpdate"),
159- * which would be forbiden due to inheritance */
160-
161-
162- // / class handling a 3D unknown line for bundle adjusment
163- class cUK_Line3D_4BA : public cObjWithUnkowns <tREAL8>
164- {
165- public :
166- // < constructor,
167- cUK_Line3D_4BA (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject *,cREAL8_RSNL *);
168- // < called to fill the "obs" in an equation
169- void PushObs (std::vector<double >&);
170- // cCam2_Line_2Dto3D(const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject *);
171-
172- void AddEquation (tREAL8 aSigmaLine,int aNbPts);
173- private :
174- void AddOneEquation (tREAL8 aLambda, tREAL8 aWeight,const cOneData_L23&);
175- void InitNormals ();
176-
177- // / "reaction" after linear update
178- void OnUpdate () override ;
179- // / method called when the object must indicate its unknowns
180- void PutUknowsInSetInterval () override ;
181-
182- cREAL8_RSNL * mSys ;
183- cCam2_Line_2Dto3D mLineInit ;
184- tSegComp3dr mSeg ;
185- cPt3dr mNorm_x ; // < the first vector normal
186- cPt3dr mNorm_y ; // < the second vector normal
187- cPt2dr_UK mUkN1 ; // < unknown displacement at Seg.P1, coded as "Uk1.x Nx+ Uk1.y Ny"
188- cPt2dr_UK mUkN2 ; // < unknown displacement at Seg.P2
189- // cUK_Line3D_4BA_Data mData;
190- };
191-
192-
193207
194208
195209/* *********************************************************** */
@@ -198,8 +212,8 @@ class cUK_Line3D_4BA : public cObjWithUnkowns<tREAL8>
198212/* */
199213/* *********************************************************** */
200214
201- cUK_Line3D_4BA::cUK_Line3D_4BA (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject * aPhProj, cREAL8_RSNL * aSys ) :
202- mSys (aSys ),
215+ cUK_Line3D_4BA::cUK_Line3D_4BA (const std::vector<cSensorCamPC *> & aVCam,cPhotogrammetricProject * aPhProj,cMMVII_BundleAdj * aBA ) :
216+ mBA (aBA ),
203217 mLineInit (aVCam,aPhProj),
204218 mSeg (mLineInit .Seg3d()),
205219 mUkN1 (cPt2dr(0 ,0 ),std::string(" Line3d_Uk1" ) + mLineInit.NameLine()),
@@ -291,7 +305,7 @@ void cUK_Line3D_4BA::AddOneEquation(tREAL8 aLambda,tREAL8 aWeight,const cOneData
291305 }
292306 }
293307
294- mSys ->R_CalcAndAddObs (aData.SetAndGet_CalcEqSeg (),aVIndexes,aVObs,aWeight);
308+ mBA -> Sys () ->R_CalcAndAddObs (aData.SetAndGet_CalcEqSeg (),aVIndexes,aVObs,aWeight);
295309}
296310
297311void cUK_Line3D_4BA::AddEquation (tREAL8 aSigmaLine,int aNbPts)
0 commit comments