Skip to content

Commit 4029b01

Browse files
author
deseilligny
committed
In bundlelines
1 parent 02047de commit 4029b01

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

MMVII/src/BundleAdjustment/BundleLines.cpp

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,46 @@
33
namespace MMVII
44
{
55

6+
/** in cUK_Line3D_4BA with put data in a specific class to allow copy (in "OnUpdate"),
7+
* which would be forbiden due to inheritance */
8+
69
struct cUK_Line3D_4BA_Data
710
{
811
cUK_Line3D_4BA_Data (const cPt3dr & aP1,const cPt3dr & aP2);
912
void Update() ;
13+
void PushObs(std::vector<double>&);
1014

11-
tSegComp3dr mSeg;
12-
cPt3dr mNorm_x;
13-
cPt3dr mNorm_y;
14-
cPt2dr mUkN1;
15-
cPt2dr mUkN2;
15+
tSegComp3dr mSeg; //< the segement itself
16+
cPt3dr mNorm_x; //< the first vector normal
17+
cPt3dr mNorm_y; //< the second vector normal
18+
cPt2dr mUkN1; //< unknown displacement at Seg.P1, coded as "Uk1.x Nx+ Uk1.y Ny"
19+
cPt2dr mUkN2; //< unknown displacement at Seg.P2
1620
};
1721

1822
/// class handling a 3D unknown line for bundle adjusment
1923
class cUK_Line3D_4BA : public cObjWithUnkowns<tREAL8>
2024
{
2125
public :
26+
//< constructor,
2227
cUK_Line3D_4BA(const cPt3dr & aP1,const cPt3dr & aP2);
28+
//< called to fill the "obs" in an equation
29+
void PushObs(std::vector<double>&);
30+
2331
private :
2432

2533

2634
/// "reaction" after linear update
2735
void OnUpdate() override;
36+
/// method called when the object must indicate its unknowns
2837
void PutUknowsInSetInterval() override;
2938

30-
cUK_Line3D_4BA_Data mData;
39+
cUK_Line3D_4BA_Data* mData;
3140
};
3241

3342

3443
/* *********************************************************** */
3544
/* */
36-
/* cUK_Line3D_4BA */
45+
/* cUK_Line3D_4BA_Data */
3746
/* */
3847
/* *********************************************************** */
3948

@@ -55,18 +64,41 @@ void cUK_Line3D_4BA_Data::Update()
5564
*this = cUK_Line3D_4BA_Data(aNewP1,aNewP2);
5665

5766
}
67+
void cUK_Line3D_4BA_Data::PushObs(std::vector<double>& aVObs)
68+
{
69+
mSeg.P1().PushInStdVector(aVObs);
70+
mSeg.P2().PushInStdVector(aVObs);
71+
mNorm_x.PushInStdVector(aVObs);
72+
mNorm_y.PushInStdVector(aVObs);
73+
74+
}
75+
76+
/* *********************************************************** */
77+
/* */
78+
/* cUK_Line3D_4BA */
79+
/* */
80+
/* *********************************************************** */
5881

5982
cUK_Line3D_4BA::cUK_Line3D_4BA(const cPt3dr & aP1,const cPt3dr & aP2) :
60-
mData (aP1,aP2)
83+
mData (nullptr)
6184
{
6285
}
6386

87+
void cUK_Line3D_4BA::PutUknowsInSetInterval()
88+
{
89+
mSetInterv->AddOneInterv(mData->mUkN1);
90+
mSetInterv->AddOneInterv(mData->mUkN2);
91+
}
6492

6593
void cUK_Line3D_4BA::OnUpdate()
6694
{
67-
mData.Update();
95+
mData->Update();
6896
}
6997

98+
void cUK_Line3D_4BA::PushObs(std::vector<double>& aVObs)
99+
{
100+
mData->PushObs(aVObs);
101+
}
70102

71103

72104
};

MMVII/src/SymbDerGen/Formulas_CamStenope.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ template <typename TypeDist,typename TypeProj> class cEqColinearityCamPPC
671671
size_t aIndUk = 0;
672672
size_t aIndObs = 0;
673673

674-
cPtxd<tUk,2> aPtIm = VtoP2AutoIncr(aVObs,&aIndObs);
675-
cPtxd<tUk,2> aPtNormIm;
674+
cPtxd<tUk,2> aPtIm = VtoP2AutoIncr(aVObs,&aIndObs);
675+
cPtxd<tUk,2> aPtNormIm;
676676
if (mLine)
677677
{
678678
aPtNormIm = VtoP2AutoIncr(aVObs,&aIndObs);
@@ -722,23 +722,23 @@ template <typename TypeDist,typename TypeProj> class cEqColinearityCamPPC
722722
cPtxd<tUk,3> aPCam = aDeltaRot * (aRotInit * aVCP);
723723
#endif
724724

725-
cPtxd<tUk,2> aPProj = cHelperProj<TypeProj>::Proj(aPCam); // project 3D-> photogram point
726-
cPtxd<tUk,2> aPDist = VtoP2(mDist.PProjToImNorm (aPProj.x(),aPProj.y(),aVUk,aIndUk)); // add distorsion
725+
cPtxd<tUk,2> aPProj = cHelperProj<TypeProj>::Proj(aPCam); // project 3D-> photogram point
726+
cPtxd<tUk,2> aPDist = VtoP2(mDist.PProjToImNorm (aPProj.x(),aPProj.y(),aVUk,aIndUk)); // add distorsion
727727

728-
cPtxd<tUk,2> aPPix = aPP + aPDist * aFoc; // Use Focal and PP to make pixel
728+
cPtxd<tUk,2> aPPix = aPP + aPDist * aFoc; // Use Focal and PP to make pixel
729729

730730

731731
MMVII_INTERNAL_ASSERT_always(aIndUk+mDist.VNamesParams().size()==aVUk.size(),"cEqColinearityCamPPC : Uk-size");
732732
MMVII_INTERNAL_ASSERT_always(aIndObs== aVObs.size(),"cEqColinearityCamPPC : Obs-size");
733733

734-
cPtxd<tUk,2> aResidual = aPPix - aPtIm; // compare to mesured point
734+
cPtxd<tUk,2> aResidual = aPPix - aPtIm; // compare to mesured point
735735
if (mLine)
736736
{
737737
return {Scal(aPtNormIm,aResidual)};
738738
}
739739
else
740740
{
741-
return {aResidual.x(),aResidual.y()};
741+
return {aResidual.x(),aResidual.y()};
742742
}
743743
}
744744

0 commit comments

Comments
 (0)