【发布时间】:2020-09-28 11:55:52
【问题描述】:
我正在尝试使用skimage.feature.orb 对齐延时图像以提取关键点,然后使用skimage.measure.ransac 过滤它们。然后,由 RANSAC 建模的变换应该能够对齐我的图像。
该过程似乎运行良好,我得到了大量的关键点匹配,然后由 RANSAC 很好地过滤。模型化的变换完美地纠正了旋转,但每次都发生了平移。
我是否只是误解了应该如何应用转换,或者 RANSAC 如何对其建模?
# Extract and match features from both images
descriptor_extractor = ORB(n_keypoints = 400, harris_k = 0.0005)
descriptor_extractor.detect_and_extract(image_ref)
descriptors_ref, keypoints_ref = descriptor_extractor.descriptors, descriptor_extractor.keypoints
descriptor_extractor.detect_and_extract(image)
descriptors, keypoints = descriptor_extractor.descriptors, descriptor_extractor.keypoints
# Match features in both images
matches = match_descriptors(descriptors_ref, descriptors, cross_check = True)
# Filter keypoints to remove non-matching
matches_ref, matches = keypoints_ref[matches[:, 0]], keypoints[matches[:, 1]]
# Robustly estimate transform model with RANSAC
transform_robust, inliers = ransac((matches_ref, matches), EuclideanTransform, min_samples = 5, residual_threshold = 0.5, max_trials = 1000)
# Apply transformation to image
image = warp(image, transform_robust.inverse, order = 1, mode = "constant", cval = 0, clip = True, preserve_range = True)
我得到与其他图像类似的结果。我也尝试过将 RANSAC 的内点与 skimage.transform.estimate_transform 一起使用,但它提供的结果与直接使用 transform_robust 相同。
【问题讨论】:
标签: python image-processing scikit-image coordinate-transformation ransac