Reputation: 33
I'm trying to register an MR image with a reference CT image. I'm using ORB based on come code I copied and pasted online, but I'm not having much luck with getting correct feature mapping as shown in the image below. I hope this can be fixed by either tuning the ORB parameters or the ransac parameters. Does anyone have any pointers or tips? It would be greatly appreciated
def featureMapping(img, refImg):
# create similar contrast in CT and MR images
img = exposure.equalize_hist(img)
refImg = exposure.equalize_hist(refImg)
orb = ORB(n_keypoints=1000, fast_threshold=0.01)
orb.detect_and_extract(refImg)
keypoints1 = orb.keypoints
descriptors1 = orb.descriptors
orb.detect_and_extract(img)
keypoints2 = orb.keypoints
descriptors2 = orb.descriptors
matches12 = match_descriptors(descriptors1, descriptors2, cross_check=True)
# Select keypoints from the source (image to be registered)
# and target (reference image)
src = keypoints2[matches12[:, 1]][:, ::-1]
dst = keypoints1[matches12[:, 0]][:, ::-1]
model_robust, inliers = ransac((src, dst), SimilarityTransform,
min_samples=10, residual_threshold=5, max_trials=300)
fig, ax = plt.subplots(1, 1, figsize=(30, 30))
plot_matches(ax, refImg, img, keypoints1, keypoints2, matches12[inliers])
#ax.axis('off')
plt.show()
Here is a plot the matched keypoints this generated and the images I am trying to register: Image
Upvotes: 1
Views: 525