Skip to content

Instantly share code, notes, and snippets.

@yudi-matsuzake
Created March 16, 2017 00:16
Show Gist options
  • Save yudi-matsuzake/507c73c7f409f3c5c6f68e61a577ff11 to your computer and use it in GitHub Desktop.
Save yudi-matsuzake/507c73c7f409f3c5c6f68e61a577ff11 to your computer and use it in GitHub Desktop.
scikit-image daisy example
import skimage.feature
import skimage.data
import skimage.color
import skimage as sk
import matplotlib.pyplot as plt
img_astronaut = sk.color.rgb2gray(sk.data.astronaut())
img_photographer = sk.data.camera()
parameters = [
{
'img' : img_photographer,
'step' : 50,
'radius' : 10,
'rings' : 1,
'histograms' : 6,
'orientations' : 8,
},
{
'img' : img_photographer,
'step' : 250,
'radius' : 100,
'rings' : 3,
'histograms' : 6,
'orientations' : 8,
},
{
'img' : img_photographer,
'step' : 180,
'radius' : 58,
'rings' : 2,
'histograms' : 6,
'orientations' : 8,
},
{
'img' : img_astronaut,
'step' : 200,
'radius' : 75,
'rings' : 1,
'histograms' : 3,
'orientations' : 4,
},
{
'img' : img_astronaut,
'step' : 180,
'radius' : 58,
'rings' : 2,
'histograms' : 6,
'orientations' : 8,
},
{
'img' : img_astronaut,
'step' : 100,
'radius' : 50,
'rings' : 1,
'histograms' : 5,
'orientations' : 8,
}
]
n_parameters = len(parameters)
for i, p in enumerate(parameters):
descs, descs_img = sk.feature.daisy(visualize=True, **p)
plt.subplot(2, n_parameters/2, i+1)
plt.axis('off')
plt.imshow(descs_img)
descs_num = descs.shape[0] * descs.shape[1]
plt.title('%i DAISY descriptors extracted:' % descs_num)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment