anivis 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.
- anivis-0.1.0/CHANGELOG.md +23 -0
- anivis-0.1.0/LICENSE +21 -0
- anivis-0.1.0/MANIFEST.in +18 -0
- anivis-0.1.0/PKG-INFO +216 -0
- anivis-0.1.0/README.md +171 -0
- anivis-0.1.0/pyproject.toml +84 -0
- anivis-0.1.0/setup.cfg +4 -0
- anivis-0.1.0/src/anivis/__init__.py +131 -0
- anivis-0.1.0/src/anivis/_version.py +3 -0
- anivis-0.1.0/src/anivis/color.py +119 -0
- anivis-0.1.0/src/anivis/edges.py +151 -0
- anivis-0.1.0/src/anivis/exceptions.py +43 -0
- anivis-0.1.0/src/anivis/filter.py +92 -0
- anivis-0.1.0/src/anivis/io.py +157 -0
- anivis-0.1.0/src/anivis/metrics.py +162 -0
- anivis-0.1.0/src/anivis/morphology.py +170 -0
- anivis-0.1.0/src/anivis/threshold.py +117 -0
- anivis-0.1.0/src/anivis/transform.py +175 -0
- anivis-0.1.0/src/anivis/types.py +31 -0
- anivis-0.1.0/src/anivis/validation.py +186 -0
- anivis-0.1.0/src/anivis.egg-info/PKG-INFO +216 -0
- anivis-0.1.0/src/anivis.egg-info/SOURCES.txt +45 -0
- anivis-0.1.0/src/anivis.egg-info/dependency_links.txt +1 -0
- anivis-0.1.0/src/anivis.egg-info/requires.txt +23 -0
- anivis-0.1.0/src/anivis.egg-info/top_level.txt +2 -0
- anivis-0.1.0/src/visionkit/__init__.py +10 -0
- anivis-0.1.0/src/visionkit/_version.py +3 -0
- anivis-0.1.0/src/visionkit/color.py +119 -0
- anivis-0.1.0/src/visionkit/edges.py +151 -0
- anivis-0.1.0/src/visionkit/exceptions.py +23 -0
- anivis-0.1.0/src/visionkit/filter.py +92 -0
- anivis-0.1.0/src/visionkit/io.py +157 -0
- anivis-0.1.0/src/visionkit/metrics.py +162 -0
- anivis-0.1.0/src/visionkit/morphology.py +170 -0
- anivis-0.1.0/src/visionkit/threshold.py +117 -0
- anivis-0.1.0/src/visionkit/transform.py +175 -0
- anivis-0.1.0/src/visionkit/types.py +31 -0
- anivis-0.1.0/src/visionkit/validation.py +3 -0
- anivis-0.1.0/tests/test_color.py +67 -0
- anivis-0.1.0/tests/test_edges.py +59 -0
- anivis-0.1.0/tests/test_filter.py +39 -0
- anivis-0.1.0/tests/test_io.py +51 -0
- anivis-0.1.0/tests/test_metrics.py +46 -0
- anivis-0.1.0/tests/test_morphology.py +49 -0
- anivis-0.1.0/tests/test_threshold.py +42 -0
- anivis-0.1.0/tests/test_transform.py +58 -0
- anivis-0.1.0/tests/test_validation.py +74 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-10-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Core package architecture with `src/visionkit` layout.
|
|
12
|
+
- Custom exception hierarchy: `VisionKitError`, `ValidationError`, `InvalidImageError`, `InvalidKernelError`, `ImageReadError`, `ImageWriteError`, and `UnsupportedFormatError`.
|
|
13
|
+
- Input validation module for array dimensions, channel counts, dtypes, kernel sizes, and numeric ranges.
|
|
14
|
+
- Image I/O: `vk.read()` and `vk.save()` with native RGB color space default and automatic directory creation.
|
|
15
|
+
- Color transformations: `vk.grayscale()`, `vk.to_rgb()`, `vk.rgb_to_bgr()`, `vk.bgr_to_rgb()`, `vk.rgb_to_hsv()`, `vk.hsv_to_rgb()`.
|
|
16
|
+
- Geometric transformations: `vk.resize()` with single-dimension aspect-ratio preservation, `vk.flip()`, and `vk.crop()`.
|
|
17
|
+
- Smoothing & Filtering: `vk.gaussian_blur()`, `vk.median_blur()`, `vk.box_blur()`, and `vk.bilateral_filter()`.
|
|
18
|
+
- Edge Detection: `vk.detect_edges()` (supporting Canny, Sobel, Laplacian, Scharr) and `vk.sobel_gradients()`.
|
|
19
|
+
- Thresholding: `vk.threshold()` (binary, Otsu, triangle) and `vk.adaptive_threshold()`.
|
|
20
|
+
- Morphology: `vk.erode()`, `vk.dilate()`, `vk.morphology_open()`, `vk.morphology_close()`, `vk.morphology_gradient()`, `vk.top_hat()`, and `vk.black_hat()`.
|
|
21
|
+
- Quality Metrics: `vk.mean_squared_error()`, `vk.psnr()`, and `vk.ssim()`.
|
|
22
|
+
- Comprehensive automated test suite with synthetic image fixtures.
|
|
23
|
+
- Quickstart example script `example.py` with automatic sample generator.
|
anivis-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anirudh Ghanshyam Sarve
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
anivis-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Include documentation and license
|
|
2
|
+
include LICENSE
|
|
3
|
+
include README.md
|
|
4
|
+
include CHANGELOG.md
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
|
|
7
|
+
# Exclude scratch, inputs, outputs, and temporary processing directories
|
|
8
|
+
prune input
|
|
9
|
+
prune output
|
|
10
|
+
prune benchmarks
|
|
11
|
+
prune .github
|
|
12
|
+
prune .pytest_cache
|
|
13
|
+
|
|
14
|
+
exclude example.py
|
|
15
|
+
exclude process_inputs.py
|
|
16
|
+
exclude *.jpg
|
|
17
|
+
exclude *.png
|
|
18
|
+
exclude .coverage
|
anivis-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: anivis
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A modular, reliable, and developer-friendly Python computer vision library
|
|
5
|
+
Author: Anirudh Ghanshyam Sarve
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/anisarve2006/anivis
|
|
8
|
+
Project-URL: Repository, https://github.com/anisarve2006/anivis.git
|
|
9
|
+
Project-URL: Issues, https://github.com/anisarve2006/anivis/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/anisarve2006/anivis/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: computer-vision,image-processing,vision,perception,opencv,numpy,anivis,visionkit
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: numpy>=1.22.0
|
|
29
|
+
Requires-Dist: opencv-python-headless>=4.5.0; sys_platform != "win32"
|
|
30
|
+
Requires-Dist: opencv-python>=4.5.0; sys_platform == "win32"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
38
|
+
Provides-Extra: docs
|
|
39
|
+
Requires-Dist: sphinx>=6.0.0; extra == "docs"
|
|
40
|
+
Requires-Dist: furo>=2023.0.0; extra == "docs"
|
|
41
|
+
Requires-Dist: myst-parser>=1.0.0; extra == "docs"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: anivis[dev,docs]; extra == "all"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
|
|
48
|
+
# 📷 AniVis (VisionKit)
|
|
49
|
+
|
|
50
|
+
**A modular, reliable, and developer-friendly Python computer vision library.**
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/anivis/)
|
|
53
|
+
[](https://github.com/anisarve2006/anivis)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
[](https://github.com/astral-sh/ruff)
|
|
57
|
+
[]()
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🎯 Mission
|
|
64
|
+
|
|
65
|
+
Make reusable computer vision and visual perception tools accessible through a clean, consistent Python API.
|
|
66
|
+
|
|
67
|
+
### 📐 Design Principles
|
|
68
|
+
|
|
69
|
+
- **Modular:** Install and use only the functionality you need.
|
|
70
|
+
- **Reliable:** Validated inputs, predictable outputs, automated tests.
|
|
71
|
+
- **RGB by Default:** Native NumPy arrays in RGB format—no more unexpected BGR color inversion headaches.
|
|
72
|
+
- **Efficient:** Measure performance before optimizing (SIMD-accelerated quality metrics).
|
|
73
|
+
- **Extensible:** Support established backends (OpenCV / NumPy / SciPy) instead of reinventing every algorithm.
|
|
74
|
+
- **Developer-Friendly:** Typed signatures, helpful validation errors, and practical documentation.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## ⚡ Quickstart
|
|
79
|
+
|
|
80
|
+
### Installation from PyPI
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install anivis
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Installation from Source (Development)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Clone the repository
|
|
90
|
+
git clone https://github.com/anisarve2006/anivis.git
|
|
91
|
+
cd anivis
|
|
92
|
+
|
|
93
|
+
# Install in development mode
|
|
94
|
+
pip install -e ".[dev]"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 5-Line Example
|
|
98
|
+
|
|
99
|
+
You can import as either `anivis` or `visionkit`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import anivis as vk # or: import visionkit as vk
|
|
103
|
+
|
|
104
|
+
image = vk.read("input.jpg")
|
|
105
|
+
gray = vk.grayscale(image)
|
|
106
|
+
resized = vk.resize(gray, width=640)
|
|
107
|
+
edges = vk.detect_edges(resized)
|
|
108
|
+
vk.save(edges, "output.png")
|
|
109
|
+
|
|
110
|
+
print("Image processing completed.")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Run the built-in example script:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
python example.py
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 📦 Core Capabilities
|
|
122
|
+
|
|
123
|
+
### 1. Image I/O
|
|
124
|
+
- `vk.read(path, mode="rgb")`: Read image files into standard RGB or grayscale NumPy arrays with informative error reporting on missing or corrupt files.
|
|
125
|
+
- `vk.save(image, path, mode="rgb")`: Save NumPy arrays to disk with automatic parent directory creation.
|
|
126
|
+
|
|
127
|
+
### 2. Color Conversion
|
|
128
|
+
- `vk.grayscale(image, keep_dims=False)`: Convert RGB, BGR, or RGBA images to 2D or 3D grayscale arrays.
|
|
129
|
+
- `vk.to_rgb(image)`: Normalize any single-channel, grayscale, or RGBA image to 3-channel RGB.
|
|
130
|
+
- `vk.rgb_to_hsv(image)` / `vk.hsv_to_rgb(image)`: Fast HSV color space transformations.
|
|
131
|
+
|
|
132
|
+
### 3. Geometric Transformations
|
|
133
|
+
- `vk.resize(image, width=None, height=None, fx=None, fy=None, interpolation="linear")`: Resizing with automatic aspect ratio calculation when only one dimension is supplied.
|
|
134
|
+
- `vk.flip(image, direction="horizontal")`: Flip along horizontal, vertical, or both axes.
|
|
135
|
+
- `vk.crop(image, x, y, width, height)`: Safe bounding box cropping with bounds validation.
|
|
136
|
+
|
|
137
|
+
### 4. Smoothing and Filtering
|
|
138
|
+
- `vk.gaussian_blur(image, kernel_size=(5, 5), sigma=1.0)`: Gaussian smoothing with validated odd kernel dimensions.
|
|
139
|
+
- `vk.median_blur(image, kernel_size=5)`: Salt-and-pepper noise removal.
|
|
140
|
+
- `vk.box_blur(image, kernel_size=(5, 5))`: Normalized average box blur.
|
|
141
|
+
- `vk.bilateral_filter(image, diameter=9, sigma_color=75.0, sigma_space=75.0)`: Edge-preserving smoothing.
|
|
142
|
+
|
|
143
|
+
### 5. Edge and Gradient Detection
|
|
144
|
+
- `vk.detect_edges(image, method="canny", low_threshold=50, high_threshold=150)`: Clean edge masks (supports `canny`, `sobel`, `laplacian`, `scharr`).
|
|
145
|
+
- `vk.sobel_gradients(image)`: Returns directional gradients `(grad_x, grad_y)`, gradient magnitude, and angle in radians.
|
|
146
|
+
|
|
147
|
+
### 6. Thresholding & Binarization
|
|
148
|
+
- `vk.threshold(image, thresh=127, maxval=255, method="binary")`: Global thresholding, Otsu's thresholding, and Triangle method.
|
|
149
|
+
- `vk.adaptive_threshold(image, method="gaussian", block_size=11, c=2.0)`: Local adaptive thresholding for uneven lighting conditions.
|
|
150
|
+
|
|
151
|
+
### 7. Morphology
|
|
152
|
+
- `vk.erode`, `vk.dilate`: Fundamental morphological operators.
|
|
153
|
+
- `vk.morphology_open`, `vk.morphology_close`: Noise filtering and hole closure.
|
|
154
|
+
- `vk.morphology_gradient`, `vk.top_hat`, `vk.black_hat`: Advanced structural feature extraction.
|
|
155
|
+
|
|
156
|
+
### 8. Image Comparison Metrics
|
|
157
|
+
- `vk.mean_squared_error(im1, im2)` (or `vk.mse`): SIMD-accelerated pixel error.
|
|
158
|
+
- `vk.psnr(im1, im2)`: Peak Signal-to-Noise Ratio in dB.
|
|
159
|
+
- `vk.ssim(im1, im2)`: Structural Similarity Index.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 🧪 Testing
|
|
164
|
+
|
|
165
|
+
Run the automated test suite using `pytest`:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pytest -v
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Run test suite with code coverage:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
pytest --cov=anivis --cov-report=term-missing
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 🗺️ Development Roadmap
|
|
180
|
+
|
|
181
|
+
- [x] **01 Core Image Processing**
|
|
182
|
+
- [x] Robust I/O (RGB default)
|
|
183
|
+
- [x] Input validation & custom exception hierarchy
|
|
184
|
+
- [x] Color space utilities & Grayscale
|
|
185
|
+
- [x] Geometric transformations & Aspect-ratio resizing
|
|
186
|
+
- [x] Filtering & Smoothing
|
|
187
|
+
- [x] Edge detection (Canny, Sobel, Laplacian, Scharr)
|
|
188
|
+
- [x] Thresholding (Binary, Otsu, Adaptive)
|
|
189
|
+
- [x] Morphological operations
|
|
190
|
+
- [x] Image quality metrics (MSE, PSNR, SSIM)
|
|
191
|
+
- [ ] **02 Feature Extraction**
|
|
192
|
+
- Corner detection (Harris, Shi-Tomasi, FAST)
|
|
193
|
+
- Keypoint descriptors & Feature matching (ORB, SIFT)
|
|
194
|
+
- Hough transforms (lines and circles)
|
|
195
|
+
- [ ] **03 Visual Perception**
|
|
196
|
+
- Optical flow (Lucas-Kanade, Farneback)
|
|
197
|
+
- Visual object tracking (CSRT, KCF, ByteTrack wrapper)
|
|
198
|
+
- Camera calibration & lens distortion correction
|
|
199
|
+
- [ ] **04 Quality and Performance**
|
|
200
|
+
- Automated CI matrix (Python 3.9 - 3.13, Linux, macOS, Windows)
|
|
201
|
+
- Benchmarks & performance regression tracking
|
|
202
|
+
- [ ] **05 Public Release**
|
|
203
|
+
- Sphinx documentation site on ReadTheDocs
|
|
204
|
+
- PyPI release configuration & GitHub Actions deployment
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 👤 Author
|
|
209
|
+
|
|
210
|
+
Developed and maintained by **[Anirudh Sarve](https://github.com/anisarve2006)**.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 📄 License
|
|
215
|
+
|
|
216
|
+
AniVis is open-source software licensed under the [MIT License](LICENSE).
|
anivis-0.1.0/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 📷 AniVis (VisionKit)
|
|
4
|
+
|
|
5
|
+
**A modular, reliable, and developer-friendly Python computer vision library.**
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/anivis/)
|
|
8
|
+
[](https://github.com/anisarve2006/anivis)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
[](https://www.python.org/downloads/)
|
|
11
|
+
[](https://github.com/astral-sh/ruff)
|
|
12
|
+
[]()
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🎯 Mission
|
|
19
|
+
|
|
20
|
+
Make reusable computer vision and visual perception tools accessible through a clean, consistent Python API.
|
|
21
|
+
|
|
22
|
+
### 📐 Design Principles
|
|
23
|
+
|
|
24
|
+
- **Modular:** Install and use only the functionality you need.
|
|
25
|
+
- **Reliable:** Validated inputs, predictable outputs, automated tests.
|
|
26
|
+
- **RGB by Default:** Native NumPy arrays in RGB format—no more unexpected BGR color inversion headaches.
|
|
27
|
+
- **Efficient:** Measure performance before optimizing (SIMD-accelerated quality metrics).
|
|
28
|
+
- **Extensible:** Support established backends (OpenCV / NumPy / SciPy) instead of reinventing every algorithm.
|
|
29
|
+
- **Developer-Friendly:** Typed signatures, helpful validation errors, and practical documentation.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ⚡ Quickstart
|
|
34
|
+
|
|
35
|
+
### Installation from PyPI
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install anivis
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Installation from Source (Development)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Clone the repository
|
|
45
|
+
git clone https://github.com/anisarve2006/anivis.git
|
|
46
|
+
cd anivis
|
|
47
|
+
|
|
48
|
+
# Install in development mode
|
|
49
|
+
pip install -e ".[dev]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 5-Line Example
|
|
53
|
+
|
|
54
|
+
You can import as either `anivis` or `visionkit`:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import anivis as vk # or: import visionkit as vk
|
|
58
|
+
|
|
59
|
+
image = vk.read("input.jpg")
|
|
60
|
+
gray = vk.grayscale(image)
|
|
61
|
+
resized = vk.resize(gray, width=640)
|
|
62
|
+
edges = vk.detect_edges(resized)
|
|
63
|
+
vk.save(edges, "output.png")
|
|
64
|
+
|
|
65
|
+
print("Image processing completed.")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Run the built-in example script:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python example.py
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📦 Core Capabilities
|
|
77
|
+
|
|
78
|
+
### 1. Image I/O
|
|
79
|
+
- `vk.read(path, mode="rgb")`: Read image files into standard RGB or grayscale NumPy arrays with informative error reporting on missing or corrupt files.
|
|
80
|
+
- `vk.save(image, path, mode="rgb")`: Save NumPy arrays to disk with automatic parent directory creation.
|
|
81
|
+
|
|
82
|
+
### 2. Color Conversion
|
|
83
|
+
- `vk.grayscale(image, keep_dims=False)`: Convert RGB, BGR, or RGBA images to 2D or 3D grayscale arrays.
|
|
84
|
+
- `vk.to_rgb(image)`: Normalize any single-channel, grayscale, or RGBA image to 3-channel RGB.
|
|
85
|
+
- `vk.rgb_to_hsv(image)` / `vk.hsv_to_rgb(image)`: Fast HSV color space transformations.
|
|
86
|
+
|
|
87
|
+
### 3. Geometric Transformations
|
|
88
|
+
- `vk.resize(image, width=None, height=None, fx=None, fy=None, interpolation="linear")`: Resizing with automatic aspect ratio calculation when only one dimension is supplied.
|
|
89
|
+
- `vk.flip(image, direction="horizontal")`: Flip along horizontal, vertical, or both axes.
|
|
90
|
+
- `vk.crop(image, x, y, width, height)`: Safe bounding box cropping with bounds validation.
|
|
91
|
+
|
|
92
|
+
### 4. Smoothing and Filtering
|
|
93
|
+
- `vk.gaussian_blur(image, kernel_size=(5, 5), sigma=1.0)`: Gaussian smoothing with validated odd kernel dimensions.
|
|
94
|
+
- `vk.median_blur(image, kernel_size=5)`: Salt-and-pepper noise removal.
|
|
95
|
+
- `vk.box_blur(image, kernel_size=(5, 5))`: Normalized average box blur.
|
|
96
|
+
- `vk.bilateral_filter(image, diameter=9, sigma_color=75.0, sigma_space=75.0)`: Edge-preserving smoothing.
|
|
97
|
+
|
|
98
|
+
### 5. Edge and Gradient Detection
|
|
99
|
+
- `vk.detect_edges(image, method="canny", low_threshold=50, high_threshold=150)`: Clean edge masks (supports `canny`, `sobel`, `laplacian`, `scharr`).
|
|
100
|
+
- `vk.sobel_gradients(image)`: Returns directional gradients `(grad_x, grad_y)`, gradient magnitude, and angle in radians.
|
|
101
|
+
|
|
102
|
+
### 6. Thresholding & Binarization
|
|
103
|
+
- `vk.threshold(image, thresh=127, maxval=255, method="binary")`: Global thresholding, Otsu's thresholding, and Triangle method.
|
|
104
|
+
- `vk.adaptive_threshold(image, method="gaussian", block_size=11, c=2.0)`: Local adaptive thresholding for uneven lighting conditions.
|
|
105
|
+
|
|
106
|
+
### 7. Morphology
|
|
107
|
+
- `vk.erode`, `vk.dilate`: Fundamental morphological operators.
|
|
108
|
+
- `vk.morphology_open`, `vk.morphology_close`: Noise filtering and hole closure.
|
|
109
|
+
- `vk.morphology_gradient`, `vk.top_hat`, `vk.black_hat`: Advanced structural feature extraction.
|
|
110
|
+
|
|
111
|
+
### 8. Image Comparison Metrics
|
|
112
|
+
- `vk.mean_squared_error(im1, im2)` (or `vk.mse`): SIMD-accelerated pixel error.
|
|
113
|
+
- `vk.psnr(im1, im2)`: Peak Signal-to-Noise Ratio in dB.
|
|
114
|
+
- `vk.ssim(im1, im2)`: Structural Similarity Index.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🧪 Testing
|
|
119
|
+
|
|
120
|
+
Run the automated test suite using `pytest`:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pytest -v
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Run test suite with code coverage:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pytest --cov=anivis --cov-report=term-missing
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🗺️ Development Roadmap
|
|
135
|
+
|
|
136
|
+
- [x] **01 Core Image Processing**
|
|
137
|
+
- [x] Robust I/O (RGB default)
|
|
138
|
+
- [x] Input validation & custom exception hierarchy
|
|
139
|
+
- [x] Color space utilities & Grayscale
|
|
140
|
+
- [x] Geometric transformations & Aspect-ratio resizing
|
|
141
|
+
- [x] Filtering & Smoothing
|
|
142
|
+
- [x] Edge detection (Canny, Sobel, Laplacian, Scharr)
|
|
143
|
+
- [x] Thresholding (Binary, Otsu, Adaptive)
|
|
144
|
+
- [x] Morphological operations
|
|
145
|
+
- [x] Image quality metrics (MSE, PSNR, SSIM)
|
|
146
|
+
- [ ] **02 Feature Extraction**
|
|
147
|
+
- Corner detection (Harris, Shi-Tomasi, FAST)
|
|
148
|
+
- Keypoint descriptors & Feature matching (ORB, SIFT)
|
|
149
|
+
- Hough transforms (lines and circles)
|
|
150
|
+
- [ ] **03 Visual Perception**
|
|
151
|
+
- Optical flow (Lucas-Kanade, Farneback)
|
|
152
|
+
- Visual object tracking (CSRT, KCF, ByteTrack wrapper)
|
|
153
|
+
- Camera calibration & lens distortion correction
|
|
154
|
+
- [ ] **04 Quality and Performance**
|
|
155
|
+
- Automated CI matrix (Python 3.9 - 3.13, Linux, macOS, Windows)
|
|
156
|
+
- Benchmarks & performance regression tracking
|
|
157
|
+
- [ ] **05 Public Release**
|
|
158
|
+
- Sphinx documentation site on ReadTheDocs
|
|
159
|
+
- PyPI release configuration & GitHub Actions deployment
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 👤 Author
|
|
164
|
+
|
|
165
|
+
Developed and maintained by **[Anirudh Sarve](https://github.com/anisarve2006)**.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 📄 License
|
|
170
|
+
|
|
171
|
+
AniVis is open-source software licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "anivis"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A modular, reliable, and developer-friendly Python computer vision library"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Anirudh Ghanshyam Sarve" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"computer-vision",
|
|
17
|
+
"image-processing",
|
|
18
|
+
"vision",
|
|
19
|
+
"perception",
|
|
20
|
+
"opencv",
|
|
21
|
+
"numpy",
|
|
22
|
+
"anivis",
|
|
23
|
+
"visionkit"
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 3 - Alpha",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Intended Audience :: Science/Research",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
37
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
38
|
+
"Operating System :: OS Independent"
|
|
39
|
+
]
|
|
40
|
+
dependencies = [
|
|
41
|
+
"numpy>=1.22.0",
|
|
42
|
+
"opencv-python-headless>=4.5.0; sys_platform != 'win32'",
|
|
43
|
+
"opencv-python>=4.5.0; sys_platform == 'win32'"
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
dev = [
|
|
48
|
+
"pytest>=7.0.0",
|
|
49
|
+
"pytest-cov>=4.0.0",
|
|
50
|
+
"pytest-benchmark>=4.0.0",
|
|
51
|
+
"ruff>=0.1.0",
|
|
52
|
+
"build>=1.0.0",
|
|
53
|
+
"twine>=4.0.0"
|
|
54
|
+
]
|
|
55
|
+
docs = [
|
|
56
|
+
"sphinx>=6.0.0",
|
|
57
|
+
"furo>=2023.0.0",
|
|
58
|
+
"myst-parser>=1.0.0"
|
|
59
|
+
]
|
|
60
|
+
all = [
|
|
61
|
+
"anivis[dev,docs]"
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[project.urls]
|
|
65
|
+
Homepage = "https://github.com/anisarve2006/anivis"
|
|
66
|
+
Repository = "https://github.com/anisarve2006/anivis.git"
|
|
67
|
+
Issues = "https://github.com/anisarve2006/anivis/issues"
|
|
68
|
+
Changelog = "https://github.com/anisarve2006/anivis/blob/main/CHANGELOG.md"
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.packages.find]
|
|
71
|
+
where = ["src"]
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
minversion = "7.0"
|
|
75
|
+
addopts = "-ra -q --strict-markers"
|
|
76
|
+
testpaths = ["tests"]
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
line-length = 100
|
|
80
|
+
target-version = "py39"
|
|
81
|
+
|
|
82
|
+
[tool.ruff.lint]
|
|
83
|
+
select = ["E", "F", "W"]
|
|
84
|
+
ignore = ["E501"]
|
anivis-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""AniVis: A modular, reliable, and developer-friendly Python computer vision library.
|
|
2
|
+
|
|
3
|
+
Basic usage:
|
|
4
|
+
------------
|
|
5
|
+
>>> import anivis as vk
|
|
6
|
+
>>> image = vk.read("input.jpg")
|
|
7
|
+
>>> gray = vk.grayscale(image)
|
|
8
|
+
>>> resized = vk.resize(gray, width=640)
|
|
9
|
+
>>> edges = vk.detect_edges(resized)
|
|
10
|
+
>>> vk.save(edges, "output.png")
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from anivis._version import __version__
|
|
14
|
+
from anivis.color import (
|
|
15
|
+
bgr_to_rgb,
|
|
16
|
+
grayscale,
|
|
17
|
+
hsv_to_rgb,
|
|
18
|
+
rgb_to_bgr,
|
|
19
|
+
rgb_to_hsv,
|
|
20
|
+
to_rgb,
|
|
21
|
+
)
|
|
22
|
+
from anivis.edges import (
|
|
23
|
+
detect_edges,
|
|
24
|
+
sobel_gradients,
|
|
25
|
+
)
|
|
26
|
+
from anivis.exceptions import (
|
|
27
|
+
ImageIOError,
|
|
28
|
+
ImageReadError,
|
|
29
|
+
ImageWriteError,
|
|
30
|
+
InvalidImageError,
|
|
31
|
+
InvalidKernelError,
|
|
32
|
+
UnsupportedFormatError,
|
|
33
|
+
ValidationError,
|
|
34
|
+
AniVisError,
|
|
35
|
+
VisionKitError,
|
|
36
|
+
)
|
|
37
|
+
from anivis.filter import (
|
|
38
|
+
bilateral_filter,
|
|
39
|
+
box_blur,
|
|
40
|
+
gaussian_blur,
|
|
41
|
+
median_blur,
|
|
42
|
+
)
|
|
43
|
+
from anivis.io import (
|
|
44
|
+
read,
|
|
45
|
+
save,
|
|
46
|
+
)
|
|
47
|
+
from anivis.metrics import (
|
|
48
|
+
mean_squared_error,
|
|
49
|
+
mse,
|
|
50
|
+
psnr,
|
|
51
|
+
ssim,
|
|
52
|
+
)
|
|
53
|
+
from anivis.morphology import (
|
|
54
|
+
black_hat,
|
|
55
|
+
dilate,
|
|
56
|
+
erode,
|
|
57
|
+
get_structuring_element,
|
|
58
|
+
morphology_close,
|
|
59
|
+
morphology_gradient,
|
|
60
|
+
morphology_open,
|
|
61
|
+
top_hat,
|
|
62
|
+
)
|
|
63
|
+
from anivis.threshold import (
|
|
64
|
+
adaptive_threshold,
|
|
65
|
+
threshold,
|
|
66
|
+
)
|
|
67
|
+
from anivis.transform import (
|
|
68
|
+
crop,
|
|
69
|
+
flip,
|
|
70
|
+
resize,
|
|
71
|
+
)
|
|
72
|
+
from anivis.validation import (
|
|
73
|
+
validate_image,
|
|
74
|
+
validate_kernel_size,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
# Version
|
|
79
|
+
"__version__",
|
|
80
|
+
# I/O
|
|
81
|
+
"read",
|
|
82
|
+
"save",
|
|
83
|
+
# Color
|
|
84
|
+
"grayscale",
|
|
85
|
+
"to_rgb",
|
|
86
|
+
"rgb_to_bgr",
|
|
87
|
+
"bgr_to_rgb",
|
|
88
|
+
"rgb_to_hsv",
|
|
89
|
+
"hsv_to_rgb",
|
|
90
|
+
# Transform
|
|
91
|
+
"resize",
|
|
92
|
+
"flip",
|
|
93
|
+
"crop",
|
|
94
|
+
# Filter
|
|
95
|
+
"gaussian_blur",
|
|
96
|
+
"median_blur",
|
|
97
|
+
"box_blur",
|
|
98
|
+
"bilateral_filter",
|
|
99
|
+
# Edge detection
|
|
100
|
+
"detect_edges",
|
|
101
|
+
"sobel_gradients",
|
|
102
|
+
# Thresholding
|
|
103
|
+
"threshold",
|
|
104
|
+
"adaptive_threshold",
|
|
105
|
+
# Morphology
|
|
106
|
+
"erode",
|
|
107
|
+
"dilate",
|
|
108
|
+
"morphology_open",
|
|
109
|
+
"morphology_close",
|
|
110
|
+
"morphology_gradient",
|
|
111
|
+
"top_hat",
|
|
112
|
+
"black_hat",
|
|
113
|
+
"get_structuring_element",
|
|
114
|
+
# Metrics
|
|
115
|
+
"mean_squared_error",
|
|
116
|
+
"mse",
|
|
117
|
+
"psnr",
|
|
118
|
+
"ssim",
|
|
119
|
+
# Validation & Exceptions
|
|
120
|
+
"validate_image",
|
|
121
|
+
"validate_kernel_size",
|
|
122
|
+
"AniVisError",
|
|
123
|
+
"VisionKitError",
|
|
124
|
+
"ValidationError",
|
|
125
|
+
"InvalidImageError",
|
|
126
|
+
"InvalidKernelError",
|
|
127
|
+
"ImageIOError",
|
|
128
|
+
"ImageReadError",
|
|
129
|
+
"ImageWriteError",
|
|
130
|
+
"UnsupportedFormatError",
|
|
131
|
+
]
|