2017-10-01 10 views
1

私は次のようにexample豚()は、予期しないキーワード引数「見える化」

のコード例があるグラデーションのscikit-画像ヒストグラム実行していました:

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=(16, 16), 
        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() 

は、簡単に言えばを、それは動作しません。以下のエラーが報告されます:

宇宙飛行士の画像は、上記のセクションをコメントアウトして見ることができるので、問題はありません。なぜ誰が失敗しているのか知っていますか?

+0

あなたは 'scikit-image'のどのバージョンを使用していますか? –

+0

scikit-image == 0.13.0 – SeanJ

答えて

4

これは非常に小さなエラーですが、キーワード引数visualizeのスペルが間違っています。それがあります

fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16), 
       cells_per_block=(1, 1), visualise=True) 

詳細については、hereを参照してください。

+0

ありがとう! sckit-imageのウェブサイトが間違っています。後世のために:https://web.archive.org/web/20171001204310/http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_hog.html – SeanJ

+3

ドキュメントは間違っていません---彼らは、問題が修正されている、使用しているスキマージとは異なるバージョンのものだけです。引数はもともと 'visualise'と名づけられていましたが、' visualize'ですが、私たちの標準的な非推奨サイクルで 'visualise'を廃止することができるまで、次の2つのバージョンで受け入れられます。 –

関連する問題