Giter Club home page Giter Club logo

danini / graph-cut-ransac Goto Github PK

View Code? Open in Web Editor NEW
415.0 20.0 91.0 257.05 MB

The Graph-Cut RANSAC algorithm proposed in paper: Daniel Barath and Jiri Matas; Graph-Cut RANSAC, Conference on Computer Vision and Pattern Recognition, 2018. It is available at http://openaccess.thecvf.com/content_cvpr_2018/papers/Barath_Graph-Cut_RANSAC_CVPR_2018_paper.pdf

License: Other

C++ 99.48% CMake 0.05% Python 0.34% Shell 0.06% Dockerfile 0.01% PowerShell 0.06%
graph-cut-ransac robust-estimators computer-vision ransac pattern-recognition robust fundamental-matrix homography essential-matrix

graph-cut-ransac's People

Contributors

akaszynski avatar arthurfeeney avatar danini avatar ducha-aiki avatar eivan avatar tianjiaoding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graph-cut-ransac's Issues

Questions about PnP solutions

Hi @danini

I was trying your PNP/Ransac implementation for python. I had a few questions.

ss

It seems like opencv version ~50x faster. Is this expected because of the different pnp and ransac solutions used in methods or something is wrong ? By the way Pose solutions are nearly same for both versions.

My second question is are you planing to add other pnp methods such as SQPNP?

Thanks for your great work and sharing.

Fix OpenCV windows build

OpenCV is failing to build using MinGW.

FAILED: modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.obj 
C:\ProgramData\chocolatey\bin\c++.exe -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -ID:/a/graph-cut-ransac/graph-cut-ransac/opencv/build -ID:/a/graph-cut-ransac/graph-cut-ransac/opencv/modules/core/src -ID:/a/graph-cut-ransac/graph-cut-ransac/opencv/modules/core/include -ID:/a/graph-cut-ransac/graph-cut-ransac/opencv/build/modules/core -IC:/Strawberry/c/include -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG  -Winvalid-pch  -include "D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build/modules/core/precomp.hpp" -MD -MT modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.obj -MF modules\core\CMakeFiles\opencv_core.dir\src\umatrix.cpp.obj.d -o modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.obj -c D:/a/graph-cut-ransac/graph-cut-ransac/opencv/modules/core/src/umatrix.cpp
cc1plus.exe: warning: command-line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
cc1plus.exe: warning: command-line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
internal error in mingw32_gt_pch_use_address, at config/i386/host-mingw32.c:192: MapViewOfFileEx: Attempt to access invalid address. 

Support float/double image width and height

Hi,

Currently the python wrapper, see e.g. here:

int findFundamentalMatrix_(
// The 2D-2D point correspondences
std::vector<double>& correspondences,
// The probabilities for each 3D-3D point correspondence if available
std::vector<double> &point_probabilities,
// Output: the found inliers
std::vector<bool>& inliers,
// Output: the found 6D pose
std::vector<double> &fundamental_matrix,
// The images' sizes
int h1, int w1, int h2, int w2,

only supports integer image sizes.

As far as I can tell, these are always cast to doubles, so it would make sense to support arbitrary numbers.

In my use case I have modified the intrinsics, and hence the "virtual" image sizes become doubles. I'm unsure if rounding these to integers pose any issues to the RANSAC loop, so would prefer to insert the exact values.

Although reading the code it seems these only control neighbourhood sizes so I guess rounding shouldnt be a big issue.

Best,
Johan

Build issue

I still have build problem in google colab. How to run compiler C++17 in google colab?

CMakeFiles/SampleProject.dir/build.make:62: recipe for target 'CMakeFiles/SampleProject.dir/examples/cpp_example.cpp.o' failed
make[2]: *** [CMakeFiles/SampleProject.dir/examples/cpp_example.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/SampleProject.dir/all' failed
make[1]: *** [CMakeFiles/SampleProject.dir/all] Error 2
Makefile:83: recipe for target 'all' failed

cpp_example test2DLineFitting can not get any line

my data generate code below:
cv::Mat detected_edges(Size(640,480),CV_8UC1,Scalar(0));
cv::line(detected_edges, Point(detected_edges.cols / 4, detected_edges.rows / 4),
Point(detected_edges.cols * 3 / 4, detected_edges.rows * 3 / 4), Scalar(255));
cv::Mat points(0, 2, CV_64F),
point(1, 2, CV_64F);
for (size_t row = 0; row < detected_edges.rows; row += 1)
{
for (size_t col = 0; col < detected_edges.cols; col += 1)
{
if (detected_edges.at(row, col) > std::numeric_limits::epsilon())
{
point.at(0) = col;
point.at(1) = row;
points.push_back(point);
}
}
}
and the is output:
Neighborhood calculation time = 0.001370 secs
Elapsed time = 0.535391 secs
Inlier number before = 0
Applied number of local optimizations = 0
Applied number of graph-cuts = 0
Number of iterations = 5000

run example aborted

Hello:
I build and test project in UBUNTU1804,and build is OK.But when I try to run example "SampleProject",a exception raise,running info as below:

2D line fitting

Processed scene = 'adam'
Neighborhood calculation time = 0.000190 secs
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
Aborted (core dumped)

  Is there something wrong with my running enviroment or something else?
  Hope for your reply

Regards

a question about experimental results of paper

Dear Dr.Barath:
I am a first year master's student in the Wuhan(China) University and my research topic is photogrammtry and computer vision.
I read your paper "Graph-Cut RANSAC: Local Optimization on Spatially Coherent Structures",and run the codes in github.As I find a question about experimental results of paper,I would like to request help from you.
This question is about a pair in the paper, named Fig.4 (a) ExtremeView dataset.In the paper we get a good result. But I can not get a result similar to it(the result in paper), when I test by the codes in github.I show the my reslut in appendix. Is the reason about feature descritor? Because I found that only 19 correspondences were detected in begin.Could you give me some information about this pair?
I would be very grateful indeed for any help you could give me.
best wishes.
Weile Ma
resulf of paper

my reslut

About threshold

Hello ,could you tell me that how to determine these thresholds?
image

hi

fundamental_estimator.cpp

error

for (k = 0; k < n; k++)
{
float f[9];
cv::Mat F(3, 3, CV_32F, f);

f???????

Build Issue

Hello Barath, I'm facing build error issue.

I'm using ubuntu 18.04, OpenCV 3.4.14, gcc 10.3.0, g++ 10.3.0, libeigen3-dev 3.3.4

스크린샷 2021-05-22 오후 8 34 37

Could you please help me?

The assert failure in add_edge() of graph.h

I modify the code on the Linux OS with OpenCV 2.4.13.6 and catch the assert failure ( assert(-i != _j) in add_edge of graph.h ) error when running with 'use_graph_cut=true' .

This problem may come from the construction of 'neighbours' in Run() function of 'GCRANSAC.h'.
In my understanding, the 'neighbours' data structure contains the neighborhood relationship between nodes. For node i, its neighbor node list is neghours[i] and the first node (neghours[i][0]) should be i.

However, it seems that in my experiment, the first node is not i return by the FLANN. Then in the Labeling() function, the following code will result in the same i and n_idx, which will cause the assert error when running the function add_term2()

for (int i = 0; i < points.rows; ++i)
{
			float distance1 = static_cast<float>(estimator.Error(points.row(i), model));
			float energy1 = exp(-(distance1*distance1) / sqr_thr);

			for (int j = 1; j < neighbors[i].size(); ++j)
			{
				int n_idx = neighbors[i][j].trainIdx;

				float distance2 = static_cast<float>(estimator.Error(points.row(n_idx), model));
				float energy2 = exp(-(distance2*distance2) / sqr_thr);
				
				const float e00 = 0.5f * (energy1 + energy2);
				const float e01 = 1;
				const float e10 = 1;
				const float e11 = 1 - 0.5f * (energy1 + energy2);

				if (e00 + e11 > e01 + e10)
					printf("Non-submodular expansion term detected; smooth costs must be a metric for expansion\n");

				e->add_term2(i, n_idx, e00*lambda, e01*lambda, e10*lambda, e11*lambda);
			}

I'm not sure if I get the right meaning of 'neighbours' .
However, when I fix this bug, I get the right result.

Another issue is about the running time.
I have deleted all concurrency namespace due to the Linux environment.
The running time with GCRANSAC is larger than the version without it , i.e. set the use_graph_cut=false.
However, there can be more right matches with GCRANSAC.

I have a problem

Sorry to disturb you, follow the instructions in "readme", when I run the code according to the "examples.ipynb" given, it prompts "AttributeError: module 'pygcransac' has no attribute 'findHomography'" ,Excuse me, what should I do.

Make Error

Thanks for the great work and sharing. I met the following problem during make CC=gcc-9 CPP=g++-9 CXX=g++-9 LD=g++-9

In file included from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/fundamental_estimator.h:52:0,
                 from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/types.h:39,
                 from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/utils.h:48,
                 from /home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:3:
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/GCRANSAC.h: In member function ‘void gcransac::GCRANSAC<_ModelEstimator, _NeighborhoodGraph, _ScoringFunction, _PreemptiveModelVerification>::run(const cv::Mat&, const _ModelEstimator&, gcransac::sampler::Sampler<cv::Mat, long unsigned int>*, gcransac::sampler::Sampler<cv::Mat, long unsigned int>*, const _NeighborhoodGraph*, gcransac::Model&, _PreemptiveModelVerification&)’:
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/GCRANSAC.h:305:8: error: expected ‘(’ before ‘constexpr’
     if constexpr (!std::is_same<preemption::EmptyPreemptiveVerfication<_ModelEstimator>, _PreemptiveModelVerification>())
        ^
/home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:1481:1: error: expected ‘}’ at end of input
 }
 ^
/home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:1481:1: error: expected ‘}’ at end of input
/home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:1481:1: error: expected ‘}’ at end of input
/home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp: At global scope:
/home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:1481:1: error: expected ‘}’ at end of input
In file included from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/grid_neighborhood_graph.h:36:0,
                 from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/fundamental_estimator.h:48,
                 from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/types.h:39,
                 from /home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/utils.h:48,
                 from /home/altizure/xuyang/graph-cut-ransac/examples/cpp_example.cpp:3:
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h: In instantiation of ‘gcransac::neighborhood::NeighborhoodGraph<_DataContainer>::NeighborhoodGraph() [with _DataContainer = cv::Mat]’:
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/grid_neighborhood_graph.h:165:48:   required from here
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:56:9: warning: ‘gcransac::neighborhood::NeighborhoodGraph<cv::Mat>::initialized’ will be initialized after [-Wreorder]
    bool initialized;
         ^
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:50:34: warning:   ‘const cv::Mat* const gcransac::neighborhood::NeighborhoodGraph<cv::Mat>::container’ [-Wreorder]
    const _DataContainer  * const container;
                                  ^
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:59:4: warning:   when initialized here [-Wreorder]
    NeighborhoodGraph() : initialized(false),
    ^
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h: In instantiation of ‘gcransac::neighborhood::NeighborhoodGraph<_DataContainer>::NeighborhoodGraph(const _DataContainer*) [with _DataContainer = cv::Mat]’:
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/grid_neighborhood_graph.h:178:33:   required from here
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:53:11: warning: ‘gcransac::neighborhood::NeighborhoodGraph<cv::Mat>::neighbor_number’ will be initialized after [-Wreorder]
    size_t neighbor_number;
           ^
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:50:34: warning:   ‘const cv::Mat* const gcransac::neighborhood::NeighborhoodGraph<cv::Mat>::container’ [-Wreorder]
    const _DataContainer  * const container;
                                  ^
/home/altizure/xuyang/graph-cut-ransac/src/pygcransac/include/neighborhood_graph.h:64:4: warning:   when initialized here [-Wreorder]
    NeighborhoodGraph(const _DataContainer * const container_) :
    ^
CMakeFiles/SampleProject.dir/build.make:62: recipe for target 'CMakeFiles/SampleProject.dir/examples/cpp_example.cpp.o' failed
make[2]: *** [CMakeFiles/SampleProject.dir/examples/cpp_example.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/SampleProject.dir/all' failed
make[1]: *** [CMakeFiles/SampleProject.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

截屏2020-09-10 下午4 27 00

I am using C++17 and my gcc version is 9.0. Could you help with that?

The homograpy results are not stable

Hi @danini
Thanks for your great work and sharing.
I tried your code on d2-net matching test.
I noticed the Homography results are different even I ran the same data in the same parameters(I mean the same threshold)
which the fluctuations can not be ignored.
Could you give me some suggestions to get a stable result?

verify_pygcransac_ess ,verify_pygcransac_fundam issue

example:
dst_GT:[[[225.54083 -78.85825 ]]
[[ 29.281984 579.15247 ]]

        [[507.25708  658.83765 ]]

        [[652.5517   151.46173 ]]]

but:
dst_gc_E:
[[[-0.00518453 -0.00238829]]
[[-0.00166512 -0.00162377]]
[[-0.00022065 -0.00130998]]
[[-0.00118612 -0.00151971]]]
Are there some minor errors in the implementation of these two functions?

make error

hi danini, I have followed the build instructions, but when i run make,I get
image
but I already have the cpp in the folder,why?

ask some questions

When I make , it show fatal error: ppl.h: No such file or directory.
So,I add my local ppl.h path to the Cmakelists ,and cmake .. then make.
There still some errors.
/usr/include/c++/5/functional:1043:8: error: ‘__tuple_element_t’ does not name a type
-> __tuple_element_t<_Ind, tuple<_Tp...>> volatile&

Question about the GraphCut based outlier rejection step

Hey ‪Daniel,

I got confused with your recent implementation of the labeling function in src/pygcransac/include/GCRANSAC.h comparing with the version two year ago (7829d27).

In recent version (f13081e), while constructing the problem graph (Algorithm 3 from your paper), you defined quantity c00, c11, c01, c10 which refers to e00,e11,e01,e10 in your code. But the quantity e11 seems to be initialized as 0 (Line841 to Line 878) rather than e00 = 1.0-0.5 * energy_sum; which violates the description in Algorithm 3 as well as the way it is implementented in previous versions.

Since the defination of $\lambda$ has changed since certain commit, I am writing to double check. (If someone could provide some references for the new cost function, that would be great 👍 .)

Midsole

The return value problem of Sample() function in GCoptimization.h for linux version code

sorry for trouble!
I have configure the code in Linux OS.

However, I have found the function Sample() in file GCoptimization.h may have a problem when running the code. There is no return value, which may result in a bug in the while loop in function Run().

template <class ModelEstimator, class Model>
bool GCRANSAC<ModelEstimator, Model>::Sample(const cv::Mat &points, std::vector<int> &pool, const std::vector<std::vector<cv::DMatch>> &neighbors, int sample_number, int *sample)
{
	// TODO: replacable sampler
	for (int i = 0; i < sample_number; ++i)
	{
		int idx = (pool.size() - 1) * static_cast<float>(rand()) / RAND_MAX;
		sample[i] = pool[idx];
		pool.erase(pool.begin() + idx);
	}

	pool.reserve(pool.size() + sample_number);
	for (int i = 0; i < sample_number; ++i)
		pool.push_back(sample[i]);
}

	while (1) // Sample while needed
	{
		if (!Sample(points, pool, neighbours, sample_number, sample)) // Sampling
			continue;
		 
		if (estimator.EstimateModel(points, sample, &models)) // Estimate (and validate) models using the current sample
			break; 
	}  

``

I find my code will run in the while(1) loop and never end!
Is this a problem for my modified Linux version.

OpenCV Error: Assertion failed (CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1 == _dst->rows + _dst->cols - 1 && (CV_MAT_TYPE(_src->type) == CV_32FC2 || CV_MAT_TYPE(_src->type) == CV_64FC2) && (CV_MAT_TYPE(_dst->type) == CV_32FC2 || CV_MAT_TYPE(_dst->type) == CV_64FC2)) in cvUndistortPoints, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/undistort.cpp, line 293 *** RuntimeError: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/undistort.cpp:293: error: (-215) CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1 == _dst->rows + _dst->cols - 1 && (CV_MAT_TYPE(_src->type) == CV_32FC2 || CV_MAT_TYPE(_src->type) == CV_64FC2) && (CV_MAT_TYPE(_dst->type) == CV_32FC2 || CV_MAT_TYPE(_dst->type) == CV_64FC2) in function cvUndistortPoints

ipdb> boxx.tree(corrs)
└── /: (100, 5)float64
ipdb> corrs = np.concatenate((pts_2d, pts_3d), axis=1).astype(np.float32)
ipdb> pose, mask = pygcransac.find6DPose(
                    np.ascontiguousarray(corrs),
                    min_iters = 50,
                    max_iters = 1000,
                    probabilities = [], # Inlier probabilities. This is not used if the sampler is not 3 (NG-RANSAC) or 4 (AR-Sampler)
                    sampler = 0, # Sampler index (0 - Uniform, 1 - PROSAC, 2 - P-NAPSAC, 3 - NG-RANSAC, 4 - AR-Sampler)
                    threshold = normalized_threshold,  # Inlier-outlier threshold
                    conf = 0.99) # RANSAC confidence

OpenCV Error: Assertion failed (CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1 == _dst->rows + _dst->cols - 1 && (CV_MAT_TYPE(_src->type) == CV_32FC2 || CV_MAT_TYPE(_src->type) == CV_64FC2) && (CV_MAT_TYPE(_dst->type) == CV_32FC2 || CV_MAT_TYPE(_dst->type) == CV_64FC2)) in cvUndistortPoints, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/undistort.cpp, line 293
*** RuntimeError: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/undistort.cpp:293: error: (-215) CV_IS_MAT(_src) && CV_IS_MAT(_dst) && (_src->rows == 1 || _src->cols == 1) && (_dst->rows == 1 || _dst->cols == 1) && _src->cols + _src->rows - 1 == _dst->rows + _dst->cols - 1 && (CV_MAT_TYPE(_src->type) == CV_32FC2 || CV_MAT_TYPE(_src->type) == CV_64FC2) && (CV_MAT_TYPE(_dst->type) == CV_32FC2 || CV_MAT_TYPE(_dst->type) == CV_64FC2) in function cvUndistortPoints
ipdb>
ipdb> corrs
array([[ 2.8046786e+02,  2.6514389e+02,  6.4528513e+00,  2.0646122e+00,
         3.2528259e+01],
       [ 2.5675580e+02,  3.9382581e+02,  2.2737791e-01, -3.4455616e+01,
         2.8135864e+01],
       [ 2.2671194e+02,  2.7953876e+02, -7.1082244e+00, -2.8510253e+00,
         3.2859482e+01],
       ...,
       [ 2.5006602e+02,  2.7232767e+02, -5.4564703e-01,  4.4538838e-01,
         3.5162178e+01],
       [ 2.2997107e+02,  1.9335945e+02, -5.9092240e+00,  2.0273302e+01,
         3.2443798e+01],
       [ 2.1833121e+02,  3.8317825e+02, -1.0116789e+01, -3.2359917e+01,
         2.5990814e+01]], dtype=float32)

pygcransac.findEssentialMatrix issue

I want to apply '' pygcransac.findEssentialMatrix'' on feature point pairs extracted by other algorithms,not ORB or SIFT,I have got matching coordinate pairs。Excuse me, how to restore the rotation matrix next?Must the input matching point pair be ''cv.Keypoint'' type?thank you。

Build Issue

/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h: In function ‘void gcransac::utils::detectFeatures(std::__cxx11::string, cv::Mat, cv::Mat, cv::Mat&)’:
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:13: error: expected unqualified-id before ‘[’ token
for (auto[distance_ratio, point_1, point_2] : correspondences)
^
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:13: error: expected ‘;’ before ‘[’ token
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:14: error: ‘distance_ratio’ was not declared in this scope
for (auto[distance_ratio, point_1, point_2] : correspondences)
^
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:30: error: ‘point_1’ was not declared in this scope
for (auto[distance_ratio, point_1, point_2] : correspondences)
^
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:39: error: ‘point_2’ was not declared in this scope
for (auto[distance_ratio, point_1, point_2] : correspondences)
^
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h: In lambda function:
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:48: error: expected ‘{’ before ‘:’ token
for (auto[distance_ratio, point_1, point_2] : correspondences)
^
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h: In function ‘void gcransac::utils::detectFeatures(std::__cxx11::string, cv::Mat, cv::Mat, cv::Mat&)’:
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:48: error: expected ‘;’ before ‘:’ token
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:48: error: expected primary-expression before ‘:’ token
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:48: error: expected ‘)’ before ‘:’ token
/home/meditab/graph-cut-ransac/src/pygcransac/include/utils.h:232:48: error: expected primary-expression before ‘:’ token

This error occurs during building of the library.
Please help

Build issue

I have got the following error:

/home/old-ufo/dev/graph-cut-ransac/include/progressive_napsac_sampler.h: At global scope:
/home/old-ufo/dev/graph-cut-ransac/include/progressive_napsac_sampler.h:78:19: error: duplicate ‘const’
     const cv::Mat const *container_, // The pointer pointing to the data points
                   ^~~~~
/home/old-ufo/dev/graph-cut-ransac/include/progressive_napsac_sampler.h:110:34: error: duplicate ‘const’
    bool initialize(const cv::Mat const *container_);
                                  ^~~~~
/home/old-ufo/dev/graph-cut-ransac/include/progressive_napsac_sampler.h:121:59: error: duplicate ‘const’
   bool ProgressiveNapsacSampler::initialize(const cv::Mat const *container_)

SO tells me that one can use typedef (good solution) or just remove one const (temp hack). I solved opted for the 2nd so far
https://stackoverflow.com/a/33207786/1983544

find bugs and fixed

hi, two bugs were found recently when I use this gc-ransac.

  1. In the src/pygcransac/include/solver_fundamental_matrix_seven_point.hfile, if the sum of polynomial coefficients is zero, the program will be stuck when executing psolve.realRoots(real_roots);. So I add a protection like if(c[0]+c[1]+c[2]+c[3] < 1e-9) return false to avoid it.
  2. In the src/pygcransac/include/prosac_sampler.h file, 174 line. If 'subset_size' is bigger than 'point_number', it will be reset to 'point_number', which make '++subset_size' invalid, and then the 'while' will be executed forever. So I add a contidition like while (kth_sample_number > growth_function[subset_size - 1] && subset_size != point_number).

If you have some time, please check the code to verify that if they are bugs. Thanks a lot.

error: ISO C++17 does not allow 'register' storage class specifier

Hi Daniel,

It seems that my MacOS can not compile the project successfully, with complaints that seem to relate C++17 and compiler options. Maybe the project is not intended to be compiled on MacOS, but since the readme mentions C++17, I am just wondering if you happen to have ideas on what is going on here:

Scanning dependencies of target GraphCutRANSAC Scanning dependencies of target pygcransac [ 7%] Building CXX object CMakeFiles/GraphCutRANSAC.dir/src/pygcransac/include/GCoptimization.cpp.o In file included from /Users/richardding/Dropbox/graph-cut-ransac/src/pygcransac/include/GCoptimization.cpp:4: In file included from /Users/richardding/Dropbox/graph-cut-ransac/src/pygcransac/include/GCoptimization.h:109: /Users/richardding/Dropbox/graph-cut-ransac/src/pygcransac/include/energy.h:262:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] register Value pi = (E000 + E011 + E101 + E110) - (E100 + E010 + E001 + E111); ^~~~~~~~~ /Users/richardding/Dropbox/graph-cut-ransac/src/pygcransac/include/energy.h:263:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] register Value delta; ^~~~~~~~~ /Users/richardding/Dropbox/graph-cut-ransac/src/pygcransac/include/energy.h:264:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] register Var u; ^~~~~~~~~

I am running cmake 3.15.5, with gcc configuration
gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any insights would be appreciated!

Library extension

Hi @danini,

This is not an issue, it is a question. I couldn't find a better tab to ask this.

I am working on a problem of the form A * x = y, and I was wondering if it is possible to use your library for that.

Do you think it is possible? If so, how hard would it be? Also, where would be the best starting point?

Thank you,
Paulo Araujo

The problem of running example_rigid_transform

Hi! Daniel Barath,

I'm developing a new point set registration method, and I want to compare my method with yours.

However, when I run the example_rigid_transform in python, I got return
gc_T = None
gc_mask = [False False False False False False False False False False False False
False False False False False False False False False False False]
image

I'm confused about this results. Could you help me to solve this problem?
What's more, I'm really confused about the difference between initial_T and ground_truth_T. Why there are two transformation matrixes?

I'm looking forward to your reply!
Sincerely,

Xinyi Li

problem

when I run your code with Visual studio 2015 and opencv 3,41,some problems happen,and I do not know how to solve them,could you tell me your Operating platform?

error when compiling

2021-04-05 17-36-49屏幕截图
Hi, when I compile the GC-ransac in ubutu16.04, I encounter this problem. Do you have suggestions on how to solve this? Thanks.

Hello, danini

Hello, danini, in your engineering graph-cut-ransac, I found a mistake, but I can't solve it because I don't quite understand graph-cut-ransac, as shown below. u is a 1*4 matrix, but the program uses it over the boundary.
F->at(0) * u.at(3);
F->at(3) * u.at(4);
F->at(6) * u.at(5);
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.