mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-07 11:28:14 +08:00
Add example script for CenSurE
This commit is contained in:
@@ -18,13 +18,11 @@ the BRIEF method and provides rotation and scale-invariance, see
|
||||
`skimage.feature.ORB`.
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
from skimage import data
|
||||
from skimage import transform as tf
|
||||
from skimage.feature import (match_descriptors, corner_peaks, corner_harris,
|
||||
plot_matches, BRIEF)
|
||||
from skimage.color import rgb2gray
|
||||
from skimage import img_as_float
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
========================
|
||||
CenSurE feature detector
|
||||
========================
|
||||
|
||||
The CenSurE feature detector is a scale-invariant center-surround detectors
|
||||
(CenSurE) that claims to outperform other detectors and is capable of real-time
|
||||
implementation.
|
||||
|
||||
"""
|
||||
from skimage import data
|
||||
from skimage import transform as tf
|
||||
from skimage.feature import CenSurE
|
||||
from skimage.color import rgb2gray
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
img1 = rgb2gray(data.lena())
|
||||
tform = tf.AffineTransform(scale=(1.5, 1.5), rotation=0.5,
|
||||
translation=(150, -200))
|
||||
img2 = tf.warp(img1, tform)
|
||||
|
||||
detector = CenSurE()
|
||||
keypoints1, scales1 = detector.detect(img1)
|
||||
keypoints2, scales2 = detector.detect(img2)
|
||||
|
||||
fig, ax = plt.subplots(nrows=1, ncols=2)
|
||||
|
||||
plt.gray()
|
||||
|
||||
ax[0].imshow(img1)
|
||||
ax[0].axis('off')
|
||||
ax[0].scatter(keypoints1[:, 1], keypoints1[:, 0], 2 ** scales1,
|
||||
facecolors='none', edgecolors='r')
|
||||
|
||||
ax[1].imshow(img2)
|
||||
ax[1].axis('off')
|
||||
ax[1].scatter(keypoints2[:, 1], keypoints2[:, 0], 2 ** scales2,
|
||||
facecolors='none', edgecolors='r')
|
||||
|
||||
plt.show()
|
||||
@@ -12,13 +12,11 @@ allows to employ the very efficient Hamming distance metric for matching and
|
||||
is thus preferred for real-time applications.
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
from skimage import data
|
||||
from skimage import transform as tf
|
||||
from skimage.feature import (match_descriptors, corner_harris,
|
||||
corner_peaks, ORB, plot_matches)
|
||||
from skimage.color import rgb2gray
|
||||
from skimage import img_as_float
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user