Skip to content

Commit d9411d2

Browse files
author
Fabien Servant
committed
Upgrade survey injection for new format
1 parent 537d7f8 commit d9411d2

File tree

5 files changed

+266
-80
lines changed

5 files changed

+266
-80
lines changed

src/aliceVision/sfmData/SurveyPoint.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ struct SurveyPoint
1818
{
1919
SurveyPoint() = default;
2020

21-
SurveyPoint(const Vec3 & paramPoint3d, const Vec2 & paramSurvey)
21+
SurveyPoint(const Vec3 & paramPoint3d, const Vec2 & paramSurvey, const Vec2 & paramResidual)
2222
: point3d(paramPoint3d),
23-
survey(paramSurvey)
23+
survey(paramSurvey),
24+
residual(paramResidual)
2425
{}
2526

2627
Vec3 point3d;
2728
Vec2 survey;
29+
Vec2 residual;
2830

2931
bool operator==(const SurveyPoint& other) const
3032
{
31-
return (point3d == other.point3d) && (survey == other.survey);
33+
return (point3d == other.point3d) && (survey == other.survey) && (residual == other.residual);
3234
}
3335

3436
inline bool operator!=(const SurveyPoint& other) const { return !(*this == other); }

src/aliceVision/sfmDataIO/AlembicExporter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ void AlembicExporter::addSurveys(const sfmData::SurveyPoints & points)
676676
data.push_back(sp.point3d.z());
677677
data.push_back(sp.survey.x());
678678
data.push_back(sp.survey.y());
679+
data.push_back(sp.residual.x());
680+
data.push_back(sp.residual.y());
679681
}
680682
}
681683

src/aliceVision/sfmDataIO/AlembicImporter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ bool readSurveys(IObject iObj, sfmData::SfMData& sfmdata)
468468
IDoubleArrayProperty propData(userProps, "mvg_surveyData");
469469
propData.get(sampleData);
470470

471-
const int sampleDataSize = 5;
471+
const int sampleDataSize = 7;
472472

473473
if (sampleId.size() * sampleDataSize != sampleData->size())
474474
{
@@ -486,6 +486,8 @@ bool readSurveys(IObject iObj, sfmData::SfMData& sfmdata)
486486
pt.point3d.z() = (*sampleData)[pos * sampleDataSize + 2];
487487
pt.survey.x() = (*sampleData)[pos * sampleDataSize + 3];
488488
pt.survey.y() = (*sampleData)[pos * sampleDataSize + 4];
489+
pt.residual.x() = (*sampleData)[pos * sampleDataSize + 5];
490+
pt.residual.y() = (*sampleData)[pos * sampleDataSize + 6];
489491

490492
output[viewId].push_back(pt);
491493
}

src/aliceVision/sfmDataIO/jsonIO.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@ void saveSurveyPoints(const sfmData::SurveyPoints& spoints, bpt::ptree& parentTr
598598
pointTree.put("Z", point.point3d.z());
599599
pointTree.put("u", point.survey.x());
600600
pointTree.put("v", point.survey.y());
601+
pointTree.put("ru", point.residual.x());
602+
pointTree.put("rv", point.residual.y());
601603

602604
pointsTree.push_back(std::make_pair("", pointTree));
603605
}
@@ -623,6 +625,8 @@ void loadSurveyPoints(sfmData::SurveyPoints& spoints, bpt::ptree& parentTree)
623625
p.point3d.z() = pointTree.second.get<double>("Z");
624626
p.survey.x() = pointTree.second.get<double>("u");
625627
p.survey.y() = pointTree.second.get<double>("v");
628+
p.residual.x() = pointTree.second.get<double>("ru");
629+
p.residual.y() = pointTree.second.get<double>("rv");
626630

627631
spoints[viewId].push_back(p);
628632
}

0 commit comments

Comments
 (0)