Functions for evluation if the labeling is good/done
%load_ext autoreload
%autoreload 2
The function estimates the fundamental matrix or homography using (n-1) correspondences and returns error on that leaved-out correspondence (corr). The operation is repeated for every corr and the output is dict with those errors, together with min, mean, max and max_idx. I have got the idea from the VSAC paper
import matplotlib.pyplot as plt
corrs = np.loadtxt('sample_project/petrzin/corrs.txt')
errors = leave_one_out_F_validation(corrs, 'symepi')
print (errors.keys())
print (f'Symmetrical epipolar distance, min error = {errors["min"]:.4f}, max_error={errors["max"]:.4f}, at {errors["max_idx"]}, mean_error={errors["mean"]:.4f}')
errors = leave_one_out_F_validation(corrs, 'sampson')
print (f'Sampson error, min error = {errors["min"]:.4f}, max_error={errors["max"]:.4f}, at {errors["max_idx"]}, mean_error={errors["mean"]:.4f}')
print (get_error_stat_string(errors))
print (get_big_errors_string(errors))
import matplotlib.pyplot as plt
corrs = np.loadtxt('sample_project/petrzin/corrs.txt')
errors = leave_one_out_H_validation(corrs)
print (errors.keys())
print (f'Symmetrical transfer distance, min error = {errors["min"]:.4f}, max_error={errors["max"]:.4f}, at {errors["max_idx"]}, mean_error={errors["mean"]:.4f}')
print (get_error_stat_string(errors))