homa 0.1__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.
Potentially problematic release.
This version of homa might be problematic. Click here for more details.
- homa-0.1/LICENSE +21 -0
- homa-0.1/PKG-INFO +16 -0
- homa-0.1/README.md +8 -0
- homa-0.1/homa/__init__.py +1 -0
- homa-0.1/homa/constants.py +0 -0
- homa-0.1/homa/helpers.py +16 -0
- homa-0.1/homa/main.py +108 -0
- homa-0.1/homa.egg-info/PKG-INFO +16 -0
- homa-0.1/homa.egg-info/SOURCES.txt +12 -0
- homa-0.1/homa.egg-info/dependency_links.txt +1 -0
- homa-0.1/homa.egg-info/requires.txt +2 -0
- homa-0.1/homa.egg-info/top_level.txt +1 -0
- homa-0.1/setup.cfg +4 -0
- homa-0.1/setup.py +19 -0
homa-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Taha Shieenavaz
|
|
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.
|
homa-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: homa
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Maintainer: Taha Shieenavaz
|
|
5
|
+
Maintainer-email: tahashieenavaz@gmail.com
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img
|
|
11
|
+
src="https://raw.githubusercontent.com/tahashieenavaz/homa/main/art/homa.svg"
|
|
12
|
+
width=400
|
|
13
|
+
/>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<hr />
|
homa-0.1/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .main import *
|
|
File without changes
|
homa-0.1/homa/helpers.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import List
|
|
3
|
+
from .classes.Collection import Collection
|
|
4
|
+
from .classes.Logger import Logger
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def is_colab() -> bool:
|
|
8
|
+
return 'google.colab' in sys.modules
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def collection(items: List[any]):
|
|
12
|
+
return Collection(items)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def danger(message: str) -> None:
|
|
16
|
+
Logger.danger(message)
|
homa-0.1/homa/main.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import cv2
|
|
2
|
+
import numpy
|
|
3
|
+
from typing import List
|
|
4
|
+
from .helpers import collection
|
|
5
|
+
from .helpers import danger
|
|
6
|
+
|
|
7
|
+
from .classes.Repository import Repository
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def path(directory: str) -> None:
|
|
11
|
+
Repository.directory = directory
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def write(key: str, filename: str) -> None:
|
|
15
|
+
cv2.imwrite(
|
|
16
|
+
filename=filename,
|
|
17
|
+
img=Repository.images[key]
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def save(key: str, filename: str) -> None:
|
|
22
|
+
write(key, filename)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def image(filename: str, key: str | None = None, color: bool = True) -> None:
|
|
26
|
+
# TODO: add no extension in the file
|
|
27
|
+
if key is None:
|
|
28
|
+
key = filename
|
|
29
|
+
|
|
30
|
+
Repository.images[key] = cv2.imread(filename, int(color))
|
|
31
|
+
return Repository.images[key]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def show(key: any = None) -> None:
|
|
35
|
+
# TODO: add functionality to distinguish between camera and images
|
|
36
|
+
|
|
37
|
+
if key is not None and not isinstance(key, str):
|
|
38
|
+
Repository.imshow(f"Window #{Repository.get_counter()}", key)
|
|
39
|
+
|
|
40
|
+
elif key is None:
|
|
41
|
+
for key, image in Repository.images.items():
|
|
42
|
+
Repository.imshow(key, image)
|
|
43
|
+
|
|
44
|
+
elif key is not None:
|
|
45
|
+
if key in Repository.images:
|
|
46
|
+
Repository.imshow(key, Repository.images[key])
|
|
47
|
+
else:
|
|
48
|
+
danger(f"No image found with key {key}")
|
|
49
|
+
|
|
50
|
+
cv2.waitKey(0)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def camera():
|
|
54
|
+
capture = cv2.VideoCapture()
|
|
55
|
+
_, frame = capture.read()
|
|
56
|
+
Repository.camera_frame = frame
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def stack(keys: List[str], new_key: str, axis: int):
|
|
60
|
+
Repository.images[new_key] = numpy.concatenate(
|
|
61
|
+
collection(keys).map(lambda key: Repository.images[key]),
|
|
62
|
+
axis=axis
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def vstack(keys: List[str], new_key: str) -> None:
|
|
67
|
+
stack(keys, new_key, 1)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def hstack(keys: List[str] | str, new_key: str | None = None):
|
|
71
|
+
if isinstance(keys, str) and new_key is None:
|
|
72
|
+
hstack([keys], keys)
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
stack(keys, new_key, 0)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def blur(key: str, kernel: int | List[int] = (7, 7), new_key: str | None = None):
|
|
79
|
+
if new_key is None:
|
|
80
|
+
new_key = key
|
|
81
|
+
|
|
82
|
+
if isinstance(kernel, int):
|
|
83
|
+
kernel = (kernel, kernel)
|
|
84
|
+
|
|
85
|
+
Repository.images[new_key] = cv2.blur(
|
|
86
|
+
Repository.images[key],
|
|
87
|
+
kernel
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def sigma(x: float = 0, y: float = 0):
|
|
92
|
+
Repository.sigmaX = x
|
|
93
|
+
Repository.sigmaY = y
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def gaussian(key: str, kernel: None | List[int] = None, new_key: str | None = None):
|
|
97
|
+
if new_key is None:
|
|
98
|
+
new_key = key
|
|
99
|
+
|
|
100
|
+
if isinstance(kernel, int):
|
|
101
|
+
kernel = (kernel, kernel)
|
|
102
|
+
|
|
103
|
+
Repository.images[new_key] = cv2.GaussianBlur(
|
|
104
|
+
Repository.images[key],
|
|
105
|
+
kernel,
|
|
106
|
+
sigmaX=Repository.sigmaX,
|
|
107
|
+
sigmaY=Repository.sigmaY
|
|
108
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: homa
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Maintainer: Taha Shieenavaz
|
|
5
|
+
Maintainer-email: tahashieenavaz@gmail.com
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img
|
|
11
|
+
src="https://raw.githubusercontent.com/tahashieenavaz/homa/main/art/homa.svg"
|
|
12
|
+
width=400
|
|
13
|
+
/>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<hr />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
homa
|
homa-0.1/setup.cfg
ADDED
homa-0.1/setup.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
from setuptools import find_packages
|
|
3
|
+
|
|
4
|
+
with open("README.md") as fh:
|
|
5
|
+
description = fh.read()
|
|
6
|
+
|
|
7
|
+
setup(
|
|
8
|
+
name="homa",
|
|
9
|
+
maintainer="Taha Shieenavaz",
|
|
10
|
+
maintainer_email="tahashieenavaz@gmail.com",
|
|
11
|
+
version="0.1",
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
install_requires=[
|
|
14
|
+
"opencv-python",
|
|
15
|
+
"numpy"
|
|
16
|
+
],
|
|
17
|
+
long_description=description,
|
|
18
|
+
long_description_content_type="text/markdown",
|
|
19
|
+
)
|