KA
Kazuhito00/OpenCV-img_hash-Sample
Python版OpenCVのimg_hashモジュールを用いた画像ハッシュのサンプル
OpenCV-img_hash-Sample
Python版OpenCVのimg_hashモジュールを用いた画像ハッシュのサンプルです。

Requirement
- opencv-contrib-python 4.5.2.54 or later
Algorithm
2021/07/02時点でOpenCVには以下6アルゴリズムが実装されています。
- Average Hash
- Block Mean Hash
- Color Moment Hash
- Marr Hildreth Hash
- Perceptual Hash
- Radial Variance Hashalgorithm
各アルゴリズムのパフォーマンスチャートは以下です。

※OpenCVドキュメント Performance under different attacksより引用
Usage
「OpenCV_img_hash_Sample.ipynb」をColaboratoryかJupyter notebook上で開いて実行してください。
また、画像をハッシュリスト化しpickle保存・読み込み、画像同士の類似度を比較するサンプルも用意しています。
以下のコマンドで実行できます。
python 01_compute_sample.py
python 02_compare_sample.py
Reference
Author
高橋かずひと(https://twitter.com/KzhtTkhs)
License
OpenCV-img_hash-Sample is under Apache-2.0 License.
License(Image)
使用している画像はNHKクリエイティブ・ライブラリーのストリートバスケットをフレーム毎に静止画を取り出したものです。
On this page
Languages
Jupyter Notebook98.6%Python1.4%
Contributors
Apache License 2.0
Created July 1, 2021
Updated January 17, 2024