ImageHash 开源项目使用教程

ImageHash 开源项目使用教程

ImageHashLibrary containing perceptual hash algorithms using the ImageSharp library项目地址:https://gitcode.com/gh_mirrors/imag/ImageHash

1. 项目的目录结构及介绍

ImageHash 项目的目录结构如下:

ImageHash/
├── .github/
│   └── workflows/
│       └── ci.yml
├── src/
│   └── ImageHash/
│       ├── __init__.py
│       ├── average_hash.py
│       ├── color_hash.py
│       ├── difference_hash.py
│       ├── image_hash.py
│       ├── perceptual_hash.py
│       └── wavelet_hash.py
├── tests/
│   ├── __init__.py
│   ├── test_average_hash.py
│   ├── test_color_hash.py
│   ├── test_difference_hash.py
│   ├── test_perceptual_hash.py
│   └── test_wavelet_hash.py
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
└── setup.cfg

目录结构介绍

  • .github/workflows/: 包含 GitHub Actions 的 CI/CD 配置文件。
  • src/ImageHash/: 包含 ImageHash 库的核心代码文件。
    • init.py: 模块初始化文件。
    • average_hash.py: 实现平均哈希算法的文件。
    • color_hash.py: 实现颜色哈希算法的文件。
    • difference_hash.py: 实现差异哈希算法的文件。
    • image_hash.py: 图像哈希算法的基类文件。
    • perceptual_hash.py: 实现感知哈希算法的文件。
    • wavelet_hash.py: 实现小波哈希算法的文件。
  • tests/: 包含测试代码文件。
  • .gitignore: Git 忽略文件配置。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • pyproject.toml: 项目构建配置文件。
  • setup.cfg: 项目安装配置文件。

2. 项目的启动文件介绍

ImageHash 项目的启动文件是 src/ImageHash/__init__.py。这个文件负责初始化 ImageHash 模块,并导出主要的哈希算法类。

启动文件内容概览

from .image_hash import ImageHash
from .average_hash import AverageHash
from .color_hash import ColorHash
from .difference_hash import DifferenceHash
from .perceptual_hash import PerceptualHash
from .wavelet_hash import WaveletHash

__all__ = [
    'ImageHash',
    'AverageHash',
    'ColorHash',
    'DifferenceHash',
    'PerceptualHash',
    'WaveletHash'
]

启动文件功能

  • 导入并初始化各个哈希算法类。
  • 定义模块的公共接口。

3. 项目的配置文件介绍

ImageHash 项目的配置文件主要包括 pyproject.tomlsetup.cfg

pyproject.toml

pyproject.toml 文件用于定义项目的构建系统和其他配置。

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ImageHash"
version = "3.5.0"
description = "A image hashing library written in Python."
authors = [
    { name="Coen Meulenkamp", email="coen.meulenkamp@gmail.com" }
]
license = { file="LICENSE" }
readme = "README.md"
requires-python = ">=3.6"
dependencies = [
    "Pillow>=8.0.0"
]

setup.cfg

setup.cfg 文件用于定义项目的安装配置。

[metadata]
name = ImageHash
version = 3.5.0
description = A image hashing library written in Python.
long_description = file: README.md
long_description_content_type = text/markdown
author = Coen Meulenkamp
author_email = coen.meulenkamp@gmail.com
license = MIT
license_files = LICENSE
url = https://github.com/coenm/Image

ImageHashLibrary containing perceptual hash algorithms using the ImageSharp library项目地址:https://gitcode.com/gh_mirrors/imag/ImageHash

  • 13
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林浪其Geneva

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值