画像のコントラスト

PILインポートイメージから
インポート数学
インポートオペレータ
functoolsから減らすインポート
DEF(PIC1、PIC2)の比較:
「」「
:PARAM PIC1:画像1つのパス
:PIC2のparam:画像2パス
:リターン:比較のリターン結果
」「」
イメージ1 =イメージ.Open(PIC1)
画像2 = Image.open(PIC2)

histogram1 = image1.histogram()
histogram2 = image2.histogram()が

異なる= Math.sqrt(減らす(operator.add、リスト(マップ(ラムダA、B(AB& )** 2、histogram1、histogram2)))/ LEN(histogram1))

印刷(異なる)
のリターンは異なり

、 'D:/1.png'):( '/1.png D'の比較します

おすすめ

転載: www.cnblogs.com/Be-your-own-hero/p/11367860.html