Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么我在scikit图像中得到定向梯度(HOG)特征直方图的typeerror?_Python_Scikit Learn_Scikit Image - Fatal编程技术网

Python 为什么我在scikit图像中得到定向梯度(HOG)特征直方图的typeerror?

Python 为什么我在scikit图像中得到定向梯度(HOG)特征直方图的typeerror?,python,scikit-learn,scikit-image,Python,Scikit Learn,Scikit Image,我试图生成大小直方图。我在下面的文档示例中看到了错误 File "/Users/air/Projects/cs512-f17-project/SIFT/hog.py", line 10, in <module> cells_per_block=(1, 1), visualize=True) TypeError: hog() got an unexpected keyword argument 'visualize' visualize参数是在scikit image=0.1

我试图生成大小直方图。我在下面的文档示例中看到了错误

File "/Users/air/Projects/cs512-f17-project/SIFT/hog.py", line 10, in <module>
    cells_per_block=(1, 1), visualize=True)
TypeError: hog() got an unexpected keyword argument 'visualize'
visualize参数是在scikit image=0.14dev中引入的,旨在替代旧的visualize参数。在scikit image=0.13.x中,没有参数可视化。请确保您正在查看文档的稳定版本

import matplotlib.pyplot as plt

from skimage.feature import hog
from skimage import data, color, exposure


image = color.rgb2gray(data.astronaut())

fd, hog_image = hog(image, orientations=8, pixels_per_cell=(32, 32),
                    cells_per_block=(1, 1), visualize=True)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4), sharex=True, sharey=True)

ax1.axis('off')
ax1.imshow(image, cmap=plt.cm.gray)
ax1.set_title('Input image')
ax1.set_adjustable('box-forced')

# Rescale histogram for better display
hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 0.02))

ax2.axis('off')
ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
ax2.set_title('Histogram of Oriented Gradients')
ax1.set_adjustable('box-forced')
plt.show()