|
@@ -4,7 +4,7 @@ def print_hi(name):
|
|
print(f'Hi, {name}')
|
|
print(f'Hi, {name}')
|
|
|
|
|
|
# RANSAC Parameters
|
|
# RANSAC Parameters
|
|
- ransac_threshold = 5.0 # inlier threshold
|
|
|
|
|
|
+ ransac_threshold = 0.02 # inlier threshold
|
|
p = 0.35 # probability that any given correspondence is valid
|
|
p = 0.35 # probability that any given correspondence is valid
|
|
k = 4 # number of samples drawn per iteration
|
|
k = 4 # number of samples drawn per iteration
|
|
z = 0.99 # total probability of success after all iterations
|
|
z = 0.99 # total probability of success after all iterations
|
|
@@ -18,6 +18,7 @@ def print_hi(name):
|
|
# recompute homography matrix based on inliers
|
|
# recompute homography matrix based on inliers
|
|
H = recompute_homography(inliers)
|
|
H = recompute_homography(inliers)
|
|
print(H)
|
|
print(H)
|
|
|
|
+ np.savetxt('C:\\Git\\git.tk.informatik.tu-darmstadt.de\\StreetLight\\Assets\\StreamingAssets\\homography.csv', H)
|
|
|
|
|
|
def ransac_iters(p, k, z):
|
|
def ransac_iters(p, k, z):
|
|
""" Computes the required number of iterations for RANSAC.
|
|
""" Computes the required number of iterations for RANSAC.
|
|
@@ -79,6 +80,7 @@ def ransac(pairs, n_iters, k, threshold):
|
|
We execute the ransac loop n_iters times, so that we have a good chance to have a valid homography.
|
|
We execute the ransac loop n_iters times, so that we have a good chance to have a valid homography.
|
|
"""
|
|
"""
|
|
for iteration in range(n_iters):
|
|
for iteration in range(n_iters):
|
|
|
|
+ print(iteration)
|
|
"""
|
|
"""
|
|
First, we pick a sample of k corresponding point pairs
|
|
First, we pick a sample of k corresponding point pairs
|
|
"""
|
|
"""
|
|
@@ -178,7 +180,7 @@ def pick_samples(p1, p2, k):
|
|
n = p1.shape[0]
|
|
n = p1.shape[0]
|
|
generator = np.random.default_rng()
|
|
generator = np.random.default_rng()
|
|
random_numbers = generator.choice(n, size=k, replace=False)
|
|
random_numbers = generator.choice(n, size=k, replace=False)
|
|
- random_numbers = np.array([96, 93, 63, 118])
|
|
|
|
|
|
+ #random_numbers = np.array([96, 93, 63, 118])
|
|
sample1 = p1[random_numbers]
|
|
sample1 = p1[random_numbers]
|
|
sample2 = p2[random_numbers]
|
|
sample2 = p2[random_numbers]
|
|
|
|
|