Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[multiview] Addition of 10 points relative pose solver #474

Merged
merged 43 commits into from
May 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0d35aa4
Addition of 10 points relative pose solver
gregoire-dl Oct 23, 2018
71666d7
[software] WIP: Use F10 Solver in `FeatureMatching`
gregoire-dl Jan 8, 2019
09dacfa
[multiview] Reformatting relative pose and resection solvers / kernels
gregoire-dl Apr 12, 2019
d666022
[multiview] Remove empty `EssentialError`
gregoire-dl Apr 15, 2019
58a5364
[multiview] Remove unused `P3P_ResectionKernel_K`
gregoire-dl Apr 15, 2019
7e9e6f7
[software] `featureMatching` Fix error : in some case`geometricErrorM…
gregoire-dl Apr 15, 2019
bf14eb0
[multiview] Formatting comments and functions typography
gregoire-dl Apr 16, 2019
4ba7108
[multiview] Resolve cross dependency with `robustEstimation`
gregoire-dl Apr 16, 2019
7a0dce7
[multiview] FIx codacy issues
gregoire-dl Apr 24, 2019
445d33b
[robustEstimation] Fix codacy issues
gregoire-dl Apr 24, 2019
31bad06
[aliceVision] Formatting code
gregoire-dl Apr 25, 2019
5aeaa8d
[robustEstimaation] Rename `FittingKernel` to `PointFittingKernel`
gregoire-dl Apr 25, 2019
71a7a8c
[travis] Update dependencies
gregoire-dl Apr 26, 2019
c5ba23d
Merge branch 'develop' of https://github.com/alicevision/AliceVision …
fabiencastan Sep 18, 2019
0412d7b
[sfm] bugfix: ceres::AngleAxisRotatePoint cannot by used in-place
fabiencastan Sep 19, 2019
b87b7a8
[samples] added a sample to test F10
simogasp Mar 1, 2019
5f596ba
Merge branch 'develop' into dev_F10
fabiencastan Apr 10, 2020
613361c
Merge develop into dev_F10
fabiencastan Apr 27, 2020
d8d475c
[robustEstimation] build fix: missing include with MSVC
fabiencastan Apr 29, 2020
a7e724f
[feature] remove unused
simogasp May 2, 2020
6056cd8
[multiview] reduce scope
simogasp May 2, 2020
f954abe
[robust] const
simogasp May 2, 2020
962f206
[multiview] remove duplicated file
fabiencastan May 3, 2020
0573b90
[multiview] tests: use a fixed translate value
fabiencastan May 3, 2020
392763e
[multiview] tests: more checks
fabiencastan May 3, 2020
7c995c3
[numeric] add cheirality test functions
simogasp May 4, 2020
0ef5272
[cmake] add unit test for cheirality functions
simogasp May 4, 2020
a392bf4
[numeric] typedef --> using
simogasp May 4, 2020
3947752
[test] add safeguard to generate points in front of the camera
simogasp May 4, 2020
4d8a5ed
[test] add more trials
simogasp May 4, 2020
cccac2e
[cmake] add explicit boost test define
fabiencastan May 5, 2020
24667bd
[sfm] lossFunction as a ceres options
fabiencastan May 8, 2020
e684381
Merge remote-tracking branch 'origin/develop' into dev_F10
fabiencastan May 11, 2020
a284fcf
[ci] travis: update SfM_quality_evaluation
fabiencastan May 15, 2020
fd21b32
[multiview] typos
simogasp May 16, 2020
015b916
[multiview] missing override
simogasp May 16, 2020
6b4d6b1
[robustEstimation] no virtual when override
simogasp May 16, 2020
ffb6d2c
[multiview] const
simogasp May 16, 2020
5ce4113
[sample] fix
simogasp May 16, 2020
47244f7
[refactoring] move guidedMatching and supportEstimation in matching
simogasp May 16, 2020
c76bc69
[matching] split cpp hpp supportEstimation
simogasp May 16, 2020
a7de74d
[matching] split cpp hpp guidedMatching
simogasp May 16, 2020
ec1f0ed
[multiview] doc
simogasp May 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ script:
git clone --branch master https://github.com/alicevision/SfM_quality_evaluation.git $GT_TEST_SOURCE;
fi
cd $GT_TEST_SOURCE
git checkout 1828a5076ccca86fd523c92a768f1d518dfdbb91 # checkout a specific commit to ensure repeatability
python EvaluationLauncher.py -s "$ALICEVISION_BUILD/$BUILD_SYSTEM-$BUILD_PROCESSOR" -i Benchmarking_Camera_Calibration_2008/ -o ${GT_TEST_OUTPUT} -r ${GT_TEST_RESULTS} --limit 3
git checkout 203e55c6e70de5f79496407961eb10b15deece4b # checkout a specific commit to ensure repeatability
python EvaluationLauncher.py -s "$ALICEVISION_BUILD/$BUILD_SYSTEM-$BUILD_PROCESSOR" -i Benchmarking_Camera_Calibration_2008/ -o ${GT_TEST_OUTPUT} -r ${GT_TEST_RESULTS} -v --limit 3
cat ${GT_TEST_RESULTS}
# Return to root and remove GT huge files to avoid cache problems
cd $TRAVIS_BUILD_DIR
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ if(BUILD_SHARED_LIBS)
# Force BOOST to use dynamic libraries (avoid link error with boost program_options)
# https://lists.boost.org/boost-users/2009/11/54015.php
add_definitions(-DBOOST_ALL_DYN_LINK)
add_definitions(-DBOOST_TEST_DYN_LINK)
else()
set(Boost_USE_STATIC_LIBS ON)
endif()
Expand Down
23 changes: 11 additions & 12 deletions src/aliceVision/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# Headers
set(camera_files_headers
camera.hpp
cameraCommon.hpp
cameraUndistortImage.hpp
IntrinsicBase.hpp
IntrinsicInitMode.hpp
Pinhole.hpp
PinholeBrown.hpp
PinholeFisheye.hpp
PinholeFisheye1.hpp
PinholeRadial.hpp
camera.hpp
cameraCommon.hpp
cameraUndistortImage.hpp
IntrinsicBase.hpp
IntrinsicInitMode.hpp
Pinhole.hpp
PinholeBrown.hpp
PinholeFisheye.hpp
PinholeFisheye1.hpp
PinholeRadial.hpp
)

alicevision_add_interface(aliceVision_camera
SOURCES ${camera_files_headers}
LINKS
aliceVision_numeric
aliceVision_geometry
aliceVision_multiview
aliceVision_image
aliceVision_numeric
aliceVision_stl
aliceVision_system
)
Expand Down
6 changes: 3 additions & 3 deletions src/aliceVision/camera/Pinhole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#pragma once

#include <aliceVision/numeric/numeric.hpp>
#include <aliceVision/numeric/projection.hpp>
#include <aliceVision/geometry/Pose3.hpp>
#include <aliceVision/camera/cameraCommon.hpp>
#include <aliceVision/camera/IntrinsicBase.hpp>
#include <aliceVision/geometry/Pose3.hpp>
#include <aliceVision/multiview/projection.hpp>

#include <vector>
#include <sstream>
Expand Down Expand Up @@ -106,7 +106,7 @@ class Pinhole : public IntrinsicBase
virtual Mat34 get_projective_equivalent(const geometry::Pose3 & pose) const override
{
Mat34 P;
P_From_KRt(K(), pose.rotation(), pose.translation(), &P);
P_from_KRt(K(), pose.rotation(), pose.translation(), &P);
return P;
}

Expand Down
78 changes: 70 additions & 8 deletions src/aliceVision/feature/svgVisualization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,69 @@ float getStrokeEstimate(const std::pair<size_t,size_t> & imgSize)
return std::max(std::max(imgSize.first, imgSize.second) / float(2200), 2.0f);
}

inline void drawMatchesSideBySide(svg::svgDrawer& svgStream,
const feature::PointFeature &L,
const feature::PointFeature &R,
std::size_t offset,
float radiusLeft,
float radiusRight,
float strokeLeft,
float strokeRight,
const svg::svgStyle& lineStyle,
const svg::svgStyle& leftStyle,
const svg::svgStyle& rightStyle)
{
const float xRight = R.x() + offset;
svgStream.drawLine(L.x(), L.y(), xRight, R.y(), lineStyle);
svgStream.drawCircle(L.x(), L.y(), radiusLeft, leftStyle);
svgStream.drawCircle(xRight, R.y(), radiusRight, rightStyle);
}

inline void drawMatchesSideBySide(svg::svgDrawer& svgStream,
const std::vector<feature::PointFeature>& keypointsLeft,
const std::vector<feature::PointFeature>& keypointsRight,
std::size_t offset,
float radiusLeft,
float radiusRight,
float strokeLeft,
float strokeRight,
const svg::svgStyle& lineStyle,
const svg::svgStyle& leftStyle,
const svg::svgStyle& rightStyle,
const matching::IndMatches& matches)
{
for (const matching::IndMatch &m : matches)
{
const feature::PointFeature &L = keypointsLeft[m._i];
const feature::PointFeature &R = keypointsRight[m._j];
drawMatchesSideBySide(svgStream, L, R, offset, radiusLeft, radiusRight, strokeLeft, strokeRight, lineStyle, leftStyle, rightStyle);
}
}

inline void drawInliersSideBySide(svg::svgDrawer& svgStream,
const std::vector<feature::PointFeature>& keypointsLeft,
const std::vector<feature::PointFeature>& keypointsRight,
std::size_t offset,
float radiusLeft,
float radiusRight,
float strokeLeft,
float strokeRight,
const svg::svgStyle& lineStyle,
const svg::svgStyle& leftStyle,
const svg::svgStyle& rightStyle,
const matching::IndMatches& matches,
std::vector<size_t>& inliers)
{
for (const auto &idx : inliers)
{
const auto currMatch = matches[idx];
const feature::PointFeature &L = keypointsLeft[currMatch._i];
const feature::PointFeature &R = keypointsRight[currMatch._j];

drawMatchesSideBySide(svgStream, L, R, offset, radiusLeft, radiusRight, strokeLeft, strokeRight, lineStyle, leftStyle, rightStyle);
}
}

void drawMatchesSideBySide(const std::string& imagePathLeft,
const std::pair<size_t,size_t>& imageSizeLeft,
const std::vector<feature::PointFeature>& keypointsLeft,
Expand Down Expand Up @@ -115,10 +178,10 @@ void drawMatchesSideBySide(const std::string& imagePathLeft,

void drawHomographyMatches(const std::string& imagePathLeft,
const std::pair<size_t,size_t>& imageSizeLeft,
const std::vector<feature::PointFeature>& siofeatures_I,
const std::vector<feature::PointFeature>& features_I,
const std::string& imagePathRight,
const std::pair<size_t,size_t>& imageSizeRight,
const std::vector<feature::PointFeature>& siofeatures_J,
const std::vector<feature::PointFeature>& features_J,
const std::vector<std::pair<Mat3, matching::IndMatches>>& homographiesAndMatches,
const matching::IndMatches& putativeMatches,
const std::string& outFilename)
Expand All @@ -132,13 +195,13 @@ void drawHomographyMatches(const std::string& imagePathLeft,
svgStream.drawImage(imagePathLeft, imageSizeLeft.first, imageSizeLeft.second);
svgStream.drawImage(imagePathRight, imageSizeRight.first, imageSizeRight.second, offset);

// draw little white dots representing putative matches
// draw little white dots representing putative matches
for (const auto& match : putativeMatches)
{
const float radius{1.f};
const float strokeSize{2.f};
const feature::PointFeature &fI = siofeatures_I.at(match._i);
const feature::PointFeature &fJ = siofeatures_J.at(match._j);
const feature::PointFeature &fI = features_I.at(match._i);
const feature::PointFeature &fJ = features_J.at(match._j);
const svg::svgStyle style = svg::svgStyle().stroke("white", strokeSize);

svgStream.drawCircle(fI.x(), fI.y(), radius, style);
Expand All @@ -158,8 +221,8 @@ void drawHomographyMatches(const std::string& imagePathLeft,

for (const auto &match : bestMatchesId)
{
const feature::PointFeature &fI = siofeatures_I.at(match._i);
const feature::PointFeature &fJ = siofeatures_J.at(match._j);
const feature::PointFeature &fI = features_I.at(match._i);
const feature::PointFeature &fJ = features_J.at(match._j);

const svg::svgStyle style = svg::svgStyle().stroke(color, strokeSize);

Expand All @@ -183,7 +246,6 @@ void drawHomographyMatches(const std::string& imagePathLeft,
return;
}
svgFile.close();

}

void saveMatches2SVG(const std::string &imagePathLeft,
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/geometry/frustumIntersection_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "aliceVision/geometry/Frustum.hpp"

#include "aliceVision/multiview/NViewDataSet.hpp"
#include "aliceVision/multiview/projection.hpp"
#include "aliceVision/numeric/projection.hpp"

#include <iostream>

Expand Down
32 changes: 15 additions & 17 deletions src/aliceVision/geometry/rigidTransformation3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ void Refine_RTS(const Mat &x1,
}
}

bool ACRansac_FindRTS(const Mat &x1,
const Mat &x2,
double &S,
Vec3 &t,
Mat3 &R,
std::vector<std::size_t> &vec_inliers,
bool refine)
bool ACRansac_FindRTS(const Mat& x1,
const Mat& x2,
double& S,
Vec3& t,
Mat3& R,
std::vector<std::size_t>& vec_inliers,
bool refine)
{
assert(3 == x1.rows());
assert(3 <= x1.cols());
Expand All @@ -142,19 +142,17 @@ bool ACRansac_FindRTS(const Mat &x1,
const std::size_t numIterations = 1024;
const double dPrecision = std::numeric_limits<double>::infinity();

Mat4 RTS;
using SolverT = geometry::RTSSolver;
using KernelT = ACKernelAdaptor_PointsRegistrationSRT<SolverT, geometry::RTSSquaredResidualError>;

typedef geometry::RTSSolver SolverType;
typedef ACKernelAdaptor_PointsRegistrationSRT<
SolverType,
geometry::RTSSquaredResidualError> KernelType;
const KernelT kernel = KernelT(x1, x2);

KernelType kernel = KernelType(x1, x2);
// Robust estimation of the Projection matrix and its precision
const std::pair<double, double> ACRansacOut =
robustEstimation::ACRANSAC(kernel, vec_inliers, numIterations, &RTS, dPrecision);
robustEstimation::MatrixModel<Mat4> RTS;

const bool good = decomposeRTS(RTS, S, t, R);
// robust estimation of the Projection matrix and its precision
const std::pair<double, double> ACRansacOut = robustEstimation::ACRANSAC(kernel, vec_inliers, numIterations, &RTS, dPrecision);

const bool good = decomposeRTS(RTS.getMatrix(), S, t, R);

// return if it is not good or refine is not required
if(!good || !refine)
Expand Down
Loading