import os
from skimage import feature as ft
import cv2
def hog_feature(img_array, resize=(64,64)):
"""extract hog feature from an image.
Args:
img_array: an image array.
resize: size of the image for extracture.
Return:
features: a ndarray vector.
"""
img = cv2.cvtColor(img_array, cv2.COLOR_BGR2GRAY)
img = cv2.resize(img, resize)
bins = 9
cell_size = (8, 8)
cpb = (2, 2)
norm = "L2"
features = ft.hog(img, orientations=bins, pixels_per_cell=cell_size,
cells_per_block=cpb,block_norm=norm, transform_sqrt=True)
return features
Hog函数具有此参数,为什么会出错?