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.5.tar.gz
(25.8 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.5-py3-none-any.whl
(26.1 kB
view details)
File details
Details for the file ydl2-0.1.5.tar.gz.
File metadata
- Download URL: ydl2-0.1.5.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
152af4d37ab0c30c77dc99cf8add78207e9283a7e465cab7e735796e20e91aa7
|
|
| MD5 |
7f1b2ad4afb4221e3efd1244d9c1228e
|
|
| BLAKE2b-256 |
e541871f2f998b938bfa3395c368763b9552e4081d207156005239f5695d491d
|
File details
Details for the file ydl2-0.1.5-py3-none-any.whl.
File metadata
- Download URL: ydl2-0.1.5-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f587cf3b1031e51b59397c4ef0faada8a72064f3048089b48ac94d577ded6fb
|
|
| MD5 |
ad479f5ab9b078826340ad075acbab2a
|
|
| BLAKE2b-256 |
7ca70436d545926c0de21f4935d26bf3f4e9709cc11de1355fdd28296bdb619e
|