OpenCV 轻量扩展:Unicode 路径读写、HALCON 风格灰度缩放
Project description
ydl2
ydl2 是对 OpenCV 的轻量补充:解决 Windows 中文路径 读写问题,并提供与 HALCON 语义一致的灰度缩放算子。
安装
pip install ydl2
快速使用
import ydl2
import numpy as np
# Unicode 路径读写(Windows 中文路径)
img = ydl2.imread(r"D:\图片\测试.png")
ydl2.imwrite(r"D:\图片\输出.png", img)
# HALCON 等价算子
stretched = ydl2.scale_image_max(img) # scale_image_max
inverted = ydl2.scale_image(img, -1.0, 255.0) # scale_image(byte 反转)
mapped = ydl2.scale_image_range(img, 100, 200) # scale_image_range
# 扩展区间: [100,200] -> [50,250]
mapped2 = ydl2.scale_image_range(img, (100, 50), (200, 250))
API
| 函数 | 说明 |
|---|---|
imread / imwrite / imshow |
支持中文路径的读写与显示 |
scale_image_max |
每通道 min/max 拉伸到 0–255(byte) |
scale_image |
g' = g * Mult + Add,输出类型与输入一致 |
scale_image_range |
区间线性映射,区间外裁到目标端点(byte) |
依赖
- Python >= 3.8
- numpy >= 1.21
- opencv-python >= 4.6
链接
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ydl2-0.1.4.tar.gz
(8.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ydl2-0.1.4-py3-none-any.whl
(9.3 kB
view details)
File details
Details for the file ydl2-0.1.4.tar.gz.
File metadata
- Download URL: ydl2-0.1.4.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d079af2231dbd78c0b59325c5deae8e6707eeb4e4732b31a8bcb840bb735c28
|
|
| MD5 |
3234f3c4bf2168d5f321733ef4037142
|
|
| BLAKE2b-256 |
731a28defb2da25ef74b14fdd3a0d3a2ddbaa1c0a88f71598ca7c84fa9d5cc64
|
File details
Details for the file ydl2-0.1.4-py3-none-any.whl.
File metadata
- Download URL: ydl2-0.1.4-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c44f0f1214721d3d14b910f7aabe4aeb97ecf26d51630912953b36fecaa514da
|
|
| MD5 |
0efaf31e2a06f815e53c10fc2882529f
|
|
| BLAKE2b-256 |
78f3af4b80427e840c3f4b127860ad2ed145c538090e2b402c2060329c12972e
|