Chi Xu, Tingrui Guo, Yuan Huang, Li Cheng
Perspective-n-point is a fundamental problem in multi-view geometry, yet two critical challenges persist: (1) The issues of high outlier rate and near degenerate cases exert a substantial impact on the robustness of existing PnP methods. In the worst-case where both issues are in presence, existing methods tend to either produce erroneous results or become computationally prohibitive. (2) Conventionally, the hypothetical pose with the maximum inlier-set is assumed to be correct. However, it remains unclear whether this assumption holds when the outlier rate approaches ultra-high levels, and along this line what is the maximum amount of outliers that can be robustly handled. To address these challenges, this paper proposes a novel Hough voting based 2-point RANSAC solution. To our knowledge, it is the first PnP solution capable of accurately and efficiently handling high outlier rates in near-degenerate cases. Extensive empirical evaluations have been conducted using the proposed approach, with a particular focus on a systematic examination under ultra-high outlier rates. The results show that, on random synthetic data, our approach works robustly even when dealing with up to 99% outliers. Meanwhile on real-world datasets, the maximum inlier-set assumption oftentimes fails when the outlier rate exceeds 97%, as the incorrect hypothetical poses may yield more inliers than the ground-truths. Our dataset and source code are to be made available at [https://github.com/xuchi7/RPnP_plusplus].
Please download the files via the links below, then unzip the file to the root directory of this repository.
-
Synthetic data SynthData.zip
-
Real data RealData.zip
-
Star-River Complex StarRiver.zip
This repository contains the implementation of the proposed R2PPnP method based on Hough Voting, along with its refinement module, and the full experimental pipeline for Synthetic, Real, and StarRiver dataset experiments.
The project includes:
- Source code (
src)- Common functions (
common_funcs)
- Common functions (
- Experimental scripts for Synthetic, Real, and StarRiver data
- All required datasets under the
data/directory (default test data and results included)
src/ — Source code
common_funcs/ — Shared functions
r2ppnp.m — Proposed Hough Voting–based method
applyFinalize.m — Proposed refinement method
...
# files for Synth Data Experiments
main_syn_run.m — Main script to run synthetic data experiments
main_syn_show_results.m — Display synthetic experiment results
generate_syn_data.m — Synthetic data generation script
# files for Real Data Experiments
main_real_run.m — Main script to run real data experiments
main_real_show_results.m — Display real experiment results
main_real_show_images.m — Display real image samples
# files for StarRiver Experiments
main_starriver_show_results.m — Show StarRiver experiment results
main_starriver_show_images.m — Show StarRiver image samples
data/
RealData/
testData/ — Real data experiment inputs
testResults/ — Real data experiment outputs
SynthData/
testData/ — Synthetic data experiment inputs
testResults/ — Synthetic data experiment outputs
StarRiver/
splg/
testData/ — StarRiver synthetic-like test data
testResults/ — StarRiver experiment results
images_upright/ — StarRiver upright images
RealImages/
brandenburg_gate/
buckingham_palace/
... (totally selected 10 scenes, each containing corresponding images)
main_syn_run.m
- Uses data from
data/SynthData/testData/ - By default, results are NOT overwritten
To enable overwriting results:
-
In
common_funcs/evaluate_syn.mchange line ~73:if 1 → if 0 -
In
common_funcs/evaluate_syn_refinement.mchange line ~76:if 1 → if 0
main_syn_show_results.m
- Results are loaded from
data/SynthData/testResults/
generate_syn_data.m
-
Default data already exists in
data/SynthData/testData/ -
To regenerate new, change line 4:
if 1 → if 0
main_real_run.m
- Uses data from
data/RealData/testData/ - By default, results are NOT overwritten
To enable overwriting results:
-
In
common_funcs/evaluate_real.mchange line ~36:if 1 → if 0 -
In
common_funcs/evaluate_real_refinement.mchange line ~44:if 1 → if 0
main_real_show_results.m
- Experiments use
data/RealData/testData/ - Results are loaded from
data/RealData/testResults/
main_real_show_images.m
- Images are located in
data/RealImages/
which can be downloaded from https://www.cs.ubc.ca/~kmyi/imw2020/data.html
main_starriver_show_results.m
- Inputs:
data/StarRiver/splg/testData - Results:
data/StarRiver/splg/testResults
main_starriver_show_images.m
- Uses images from:
data/StarRiver/images_upright
Some third-party code may crash and interrupt the experiment.
To prevent this, restore the commented try–catch blocks in:
common_funcs/evaluate_real.mcommon_funcs/evaluate_real_refinement.mcommon_funcs/evaluate_syn.mcommon_funcs/evaluate_syn_refinement.m
Example change:
Original (commented out):
% try
[R1, t1, ntrial] = func(X, x, K, th_pixel, varargin{:});
% catch
% R1 = []; t1 = []; ntrial = 0;
% endReplace with:
try
[R1, t1, ntrial] = func(X, x, K, th_pixel, varargin{:});
catch
R1 = []; t1 = []; ntrial = 0;
endThis ensures experiments continue even if one method fails.