In [1]:
# Code attribution: Yiyin Shen, Tyler Caraza-Harter
# Imports
import matplotlib.pyplot as plt
import skimage
import numpy
In [2]:
# Open the image
image = skimage.io.imread('Spot.png')
img = skimage.color.rgb2gray(image)
skimage.io.imshow(img)
Out[2]:
<matplotlib.image.AxesImage at 0x2672b03de50>
In [3]:
# Compute the HOG features
hog, viz = skimage.feature.hog(img, visualize = True)
print(hog.shape)
fig, ax = plt.subplots()
ax.imshow(viz, cmap = plt.cm.gray, vmin = 0, vmax = 0.05)
(319302,)
Out[3]:
<matplotlib.image.AxesImage at 0x267683532d0>