Python ヒストグラム平坦化

イメージ説明

実現したいこと

Python エラー解消
interpの使い方でエラーが出てしまい、右の赤線で囲った部分のretrun値の正しい書き方を知りたい。

前提

ここに質問の内容を詳しく書いてください。
(例)
Pythonで、ヒストグラム平坦化を行っています。

発生している問題・エラーメッセージ

帰り値の書き方ミス
エラーメッセージ
'tuple' object cannot be interpreted as an integer

該当のソースコード

Python

1from PIL import Image 2from numpy import *3 4im = array(Image.open('AquaTermi_lowcontrast.JPG').convert('L'))5im2,cdf = imtools.histeq(im)

関数のソースコード

Python

1def histeq(im,nbr_bins=256):2 imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)3 cdf = imhist.cumsum()4 cdf = 255 * cdf / cdf[-1]5 6 im2 = interp(im.flatten(),bins[:-1],cdf)7 8 return im2.reshape(im.shape), cdf

試したこと

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

コメントを投稿

0 コメント