ydl2 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ydl2-0.1.0/LICENSE +0 -0
- ydl2-0.1.0/PKG-INFO +22 -0
- ydl2-0.1.0/README.md +8 -0
- ydl2-0.1.0/pyproject.toml +22 -0
- ydl2-0.1.0/setup.cfg +4 -0
- ydl2-0.1.0/src/ydl2/__init__.py +6 -0
- ydl2-0.1.0/src/ydl2/cn.py +40 -0
- ydl2-0.1.0/src/ydl2.egg-info/PKG-INFO +22 -0
- ydl2-0.1.0/src/ydl2.egg-info/SOURCES.txt +10 -0
- ydl2-0.1.0/src/ydl2.egg-info/dependency_links.txt +1 -0
- ydl2-0.1.0/src/ydl2.egg-info/requires.txt +2 -0
- ydl2-0.1.0/src/ydl2.egg-info/top_level.txt +1 -0
ydl2-0.1.0/LICENSE
ADDED
|
File without changes
|
ydl2-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ydl2
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 无敌的杨
|
|
5
|
+
Author-email: 无敌的杨 <ydl779762225@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/CiweiWenruo/ydl2
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy>=1.21
|
|
12
|
+
Requires-Dist: opencv-python>=4.6
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# ydl
|
|
16
|
+
|
|
17
|
+
`ydl2` 是一个对 `cv2` 的轻量二次封装工具包,用于日常计算机视觉工程中**反复出现但 cv2 没直接提供的功能**。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install ydl2
|
ydl2-0.1.0/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ydl2"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "无敌的杨"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "无敌的杨", email = "ydl779762225@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
"numpy>=1.21",
|
|
18
|
+
"opencv-python>=4.6"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/CiweiWenruo/ydl2"
|
ydl2-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import cv2
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def imread(path, flags=cv2.IMREAD_UNCHANGED):
|
|
7
|
+
"""
|
|
8
|
+
Unicode-safe image read (supports Chinese paths on Windows)
|
|
9
|
+
"""
|
|
10
|
+
if not isinstance(path, str):
|
|
11
|
+
raise TypeError("[imread] path must be str")
|
|
12
|
+
|
|
13
|
+
if not os.path.exists(path):
|
|
14
|
+
raise FileNotFoundError(f"[imread] file not exists: {path}")
|
|
15
|
+
|
|
16
|
+
data = np.fromfile(path, dtype=np.uint8)
|
|
17
|
+
img = cv2.imdecode(data, flags)
|
|
18
|
+
|
|
19
|
+
if img is None:
|
|
20
|
+
raise RuntimeError(f"[imread] cv2.imdecode failed: {path}")
|
|
21
|
+
|
|
22
|
+
return img
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def imwrite(path, img):
|
|
26
|
+
"""
|
|
27
|
+
Unicode-safe image write
|
|
28
|
+
"""
|
|
29
|
+
if img is None:
|
|
30
|
+
raise ValueError("[imwrite] img is None")
|
|
31
|
+
|
|
32
|
+
ext = os.path.splitext(path)[1].lower()
|
|
33
|
+
if ext == "":
|
|
34
|
+
raise ValueError("[imwrite] file extension is required")
|
|
35
|
+
|
|
36
|
+
success, buf = cv2.imencode(ext, img)
|
|
37
|
+
if not success:
|
|
38
|
+
raise RuntimeError(f"[imwrite] cv2.imencode failed: {path}")
|
|
39
|
+
|
|
40
|
+
buf.tofile(path)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ydl2
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 无敌的杨
|
|
5
|
+
Author-email: 无敌的杨 <ydl779762225@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/CiweiWenruo/ydl2
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy>=1.21
|
|
12
|
+
Requires-Dist: opencv-python>=4.6
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# ydl
|
|
16
|
+
|
|
17
|
+
`ydl2` 是一个对 `cv2` 的轻量二次封装工具包,用于日常计算机视觉工程中**反复出现但 cv2 没直接提供的功能**。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install ydl2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ydl2
|