-
Notifications
You must be signed in to change notification settings - Fork 93
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
cpp_example test2DLineFitting can not get any line #34
Comments
I can confirm that now, even after the linefitting procedure was exposed to public it still works very strange.
My code looks like: import pygcransac
h1, w1 = image1_orig.shape
line, mask = pygcransac.findLine2D(corners1.astype(int), w1, h1, threshold = 2.0, conf=0.99, max_iters=1000,
spatial_coherence_weight = 0.8, min_inlier_ratio_for_sprt = 0.001,
neighborhood_size = 20.0)
print(line) |
Dear All, Yeah, I realized that I simply forgot to implement the C++ side of the Python binding. |
@ducha-aiki On my side I tried import pygcransac
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
#%config InlineBackend.figure_format='retina'
filename = 'grafA.png'
image1_orig = cv.imread(filename, 0)
det = cv.ORB_create(1000)
kp1 = det.detect(image1_orig)
corners = np.array([k.pt for k in kp1]).astype(np.float64)
h1, w1 = image1_orig.shape
line, mask = pygcransac.findLine2D(corners, w1, h1, threshold = 2.0, conf=0.99, max_iters=1000,
spatial_coherence_weight = 0.8, min_inlier_ratio_for_sprt = 0.001)
print(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
The text was updated successfully, but these errors were encountered: