homa 0.21__tar.gz → 0.22__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.
- homa-0.22/PKG-INFO +108 -0
- homa-0.22/README.md +100 -0
- homa-0.22/homa/__init__.py +4 -0
- homa-0.22/homa/camera.py +21 -0
- homa-0.22/homa/filters.py +34 -0
- {homa-0.21 → homa-0.22}/homa/helpers.py +14 -0
- homa-0.22/homa/main.py +56 -0
- homa-0.22/homa/orientation.py +36 -0
- homa-0.22/homa.egg-info/PKG-INFO +108 -0
- {homa-0.21 → homa-0.22}/homa.egg-info/SOURCES.txt +3 -0
- homa-0.21/PKG-INFO +0 -16
- homa-0.21/README.md +0 -8
- homa-0.21/homa/__init__.py +0 -1
- homa-0.21/homa/main.py +0 -109
- homa-0.21/homa.egg-info/PKG-INFO +0 -16
- {homa-0.21 → homa-0.22}/LICENSE +0 -0
- {homa-0.21 → homa-0.22}/homa/classes/Collection.py +0 -0
- {homa-0.21 → homa-0.22}/homa/classes/Logger.py +0 -0
- {homa-0.21 → homa-0.22}/homa/classes/Repository.py +0 -0
- {homa-0.21 → homa-0.22}/homa/classes/__init__.py +0 -0
- {homa-0.21 → homa-0.22}/homa/constants.py +0 -0
- {homa-0.21 → homa-0.22}/homa.egg-info/dependency_links.txt +0 -0
- {homa-0.21 → homa-0.22}/homa.egg-info/requires.txt +0 -0
- {homa-0.21 → homa-0.22}/homa.egg-info/top_level.txt +0 -0
- {homa-0.21 → homa-0.22}/setup.cfg +0 -0
- {homa-0.21 → homa-0.22}/setup.py +0 -0
homa-0.22/PKG-INFO
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: homa
|
|
3
|
+
Version: 0.22
|
|
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=500
|
|
13
|
+
/>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<hr />
|
|
17
|
+
|
|
18
|
+
Homa is an easy way to start learning Computer Vision with OpenCV.
|
|
19
|
+
|
|
20
|
+
## Loading Images
|
|
21
|
+
|
|
22
|
+
Images could be loaded with the `image` helper, that accepts the file name and a key for the repository.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from homa import *
|
|
26
|
+
|
|
27
|
+
image("horse.jpg", "horse")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Alternatively, following code will load the file into the repository with a key of everything before the last in the filename.
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from homa import *
|
|
34
|
+
|
|
35
|
+
image("horse.jpg") # stored as "horse"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Smoothing
|
|
39
|
+
|
|
40
|
+
### Blur
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from homa import *
|
|
44
|
+
|
|
45
|
+
image("horse.jpg")
|
|
46
|
+
|
|
47
|
+
blur("horse", 7) # rewrites "horse" key
|
|
48
|
+
blur("horse", (7, 19)) # rewrites "horse" key
|
|
49
|
+
blur("horse", 9, "blurred horse") # as a new key in the repository
|
|
50
|
+
show("blurred horse")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Gaussian Blur
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from homa import *
|
|
57
|
+
|
|
58
|
+
image("horse.jpg")
|
|
59
|
+
|
|
60
|
+
gaussian("horse", 7) # rewrites "horse" key
|
|
61
|
+
gaussian("horse", (7, 19)) # rewrites "horse" key
|
|
62
|
+
gaussian("horse", 9, "gaussian blurred horse") # as a new key in the repository
|
|
63
|
+
show("gaussian blurred horse")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Stacking
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from homa import *
|
|
70
|
+
|
|
71
|
+
image("horse.jpg")
|
|
72
|
+
blur("horse", 9, "blurred horse")
|
|
73
|
+
|
|
74
|
+
show(
|
|
75
|
+
vstack("horse", "blurred horse"),
|
|
76
|
+
window="Vstacked"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
showWait(
|
|
80
|
+
hstack("horse", "blurred horse"),
|
|
81
|
+
window="Hstacked"
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Camera
|
|
86
|
+
|
|
87
|
+
Camera frames could be access from the repository with a key of `camera`.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from homa import *
|
|
91
|
+
|
|
92
|
+
for _ in camera():
|
|
93
|
+
show("camera")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
You can simply combine camera frames with the supported effects.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from homa import *
|
|
100
|
+
|
|
101
|
+
for _ in camera():
|
|
102
|
+
blur("camera", 13, "blurred camera")
|
|
103
|
+
|
|
104
|
+
show(
|
|
105
|
+
vstack("camera", "blurred camera"),
|
|
106
|
+
window="Camera Effect"
|
|
107
|
+
)
|
|
108
|
+
```
|
homa-0.22/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img
|
|
3
|
+
src="https://raw.githubusercontent.com/tahashieenavaz/homa/main/art/homa.svg"
|
|
4
|
+
width=500
|
|
5
|
+
/>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<hr />
|
|
9
|
+
|
|
10
|
+
Homa is an easy way to start learning Computer Vision with OpenCV.
|
|
11
|
+
|
|
12
|
+
## Loading Images
|
|
13
|
+
|
|
14
|
+
Images could be loaded with the `image` helper, that accepts the file name and a key for the repository.
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from homa import *
|
|
18
|
+
|
|
19
|
+
image("horse.jpg", "horse")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Alternatively, following code will load the file into the repository with a key of everything before the last in the filename.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from homa import *
|
|
26
|
+
|
|
27
|
+
image("horse.jpg") # stored as "horse"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Smoothing
|
|
31
|
+
|
|
32
|
+
### Blur
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from homa import *
|
|
36
|
+
|
|
37
|
+
image("horse.jpg")
|
|
38
|
+
|
|
39
|
+
blur("horse", 7) # rewrites "horse" key
|
|
40
|
+
blur("horse", (7, 19)) # rewrites "horse" key
|
|
41
|
+
blur("horse", 9, "blurred horse") # as a new key in the repository
|
|
42
|
+
show("blurred horse")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Gaussian Blur
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from homa import *
|
|
49
|
+
|
|
50
|
+
image("horse.jpg")
|
|
51
|
+
|
|
52
|
+
gaussian("horse", 7) # rewrites "horse" key
|
|
53
|
+
gaussian("horse", (7, 19)) # rewrites "horse" key
|
|
54
|
+
gaussian("horse", 9, "gaussian blurred horse") # as a new key in the repository
|
|
55
|
+
show("gaussian blurred horse")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Stacking
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from homa import *
|
|
62
|
+
|
|
63
|
+
image("horse.jpg")
|
|
64
|
+
blur("horse", 9, "blurred horse")
|
|
65
|
+
|
|
66
|
+
show(
|
|
67
|
+
vstack("horse", "blurred horse"),
|
|
68
|
+
window="Vstacked"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
showWait(
|
|
72
|
+
hstack("horse", "blurred horse"),
|
|
73
|
+
window="Hstacked"
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Camera
|
|
78
|
+
|
|
79
|
+
Camera frames could be access from the repository with a key of `camera`.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from homa import *
|
|
83
|
+
|
|
84
|
+
for _ in camera():
|
|
85
|
+
show("camera")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You can simply combine camera frames with the supported effects.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from homa import *
|
|
92
|
+
|
|
93
|
+
for _ in camera():
|
|
94
|
+
blur("camera", 13, "blurred camera")
|
|
95
|
+
|
|
96
|
+
show(
|
|
97
|
+
vstack("camera", "blurred camera"),
|
|
98
|
+
window="Camera Effect"
|
|
99
|
+
)
|
|
100
|
+
```
|
homa-0.22/homa/camera.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import cv2
|
|
2
|
+
from .classes.Repository import Repository
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def camera(delay=10):
|
|
6
|
+
capture = cv2.VideoCapture(0)
|
|
7
|
+
|
|
8
|
+
pressed_key = None
|
|
9
|
+
|
|
10
|
+
frame_number = 0
|
|
11
|
+
|
|
12
|
+
while pressed_key != ord("q"):
|
|
13
|
+
frame_number += 1
|
|
14
|
+
_, frame = capture.read()
|
|
15
|
+
|
|
16
|
+
Repository.images["camera"] = frame
|
|
17
|
+
|
|
18
|
+
yield frame_number
|
|
19
|
+
pressed_key = cv2.waitKey(delay)
|
|
20
|
+
|
|
21
|
+
capture.release()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from .classes.Repository import Repository
|
|
3
|
+
from .helpers import create_kernel
|
|
4
|
+
import cv2
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def blur(key: str, kernel: int | List[int] = (7, 7), new_key: str | None = None):
|
|
8
|
+
if new_key is None:
|
|
9
|
+
new_key = key
|
|
10
|
+
|
|
11
|
+
Repository.images[new_key] = cv2.blur(
|
|
12
|
+
Repository.images[key],
|
|
13
|
+
create_kernel(kernel)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def sigma(x: float = 0, y: float = 0):
|
|
18
|
+
Repository.sigmaX = x
|
|
19
|
+
Repository.sigmaY = y
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def gaussian(key: str, kernel: None | List[int] = None, new_key: str | None = None):
|
|
23
|
+
if new_key is None:
|
|
24
|
+
new_key = key
|
|
25
|
+
|
|
26
|
+
if isinstance(kernel, int):
|
|
27
|
+
kernel = (kernel, kernel)
|
|
28
|
+
|
|
29
|
+
Repository.images[new_key] = cv2.GaussianBlur(
|
|
30
|
+
Repository.images[key],
|
|
31
|
+
kernel,
|
|
32
|
+
sigmaX=Repository.sigmaX,
|
|
33
|
+
sigmaY=Repository.sigmaY
|
|
34
|
+
)
|
|
@@ -14,3 +14,17 @@ def collection(items: List[any]):
|
|
|
14
14
|
|
|
15
15
|
def danger(message: str) -> None:
|
|
16
16
|
Logger.danger(message)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def create_kernel(value: int | tuple) -> tuple:
|
|
20
|
+
if isinstance(value, tuple):
|
|
21
|
+
x, y = value
|
|
22
|
+
|
|
23
|
+
x = x - 1 if x % 2 == 0 else x
|
|
24
|
+
y = y - 1 if y % 2 == 0 else y
|
|
25
|
+
|
|
26
|
+
return (x, y)
|
|
27
|
+
|
|
28
|
+
value = value - 1 if value % 2 == 0 else value
|
|
29
|
+
|
|
30
|
+
return (value, value)
|
homa-0.22/homa/main.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import cv2
|
|
2
|
+
from .helpers import danger
|
|
3
|
+
from .classes.Repository import Repository
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def path(directory: str) -> None:
|
|
7
|
+
Repository.directory = directory
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def write(key: str, filename: str) -> None:
|
|
11
|
+
cv2.imwrite(
|
|
12
|
+
filename=filename,
|
|
13
|
+
img=Repository.images[key]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def save(*args, **kwargs) -> None:
|
|
18
|
+
write(args, kwargs)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def image(filename: str, key: str | None = None, color: bool = True) -> None:
|
|
22
|
+
# TODO: add no extension in the file
|
|
23
|
+
if key is None:
|
|
24
|
+
key = filename.split(".")[0]
|
|
25
|
+
|
|
26
|
+
Repository.images[key] = cv2.imread(filename, int(color))
|
|
27
|
+
return Repository.images[key]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def wait(delay=0):
|
|
31
|
+
cv2.waitKey(delay)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def showWait(*args, **kwargs):
|
|
35
|
+
kwargs["wait"] = True
|
|
36
|
+
show(*args, **kwargs)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def show(key: any = None, wait: bool = False, window: str = "Homa Window") -> None:
|
|
40
|
+
# TODO: add functionality to distinguish between camera and images
|
|
41
|
+
|
|
42
|
+
if key is not None and not isinstance(key, str):
|
|
43
|
+
Repository.imshow(window, key)
|
|
44
|
+
|
|
45
|
+
elif key is None:
|
|
46
|
+
for key, image in Repository.images.items():
|
|
47
|
+
Repository.imshow(key, image)
|
|
48
|
+
|
|
49
|
+
elif key is not None:
|
|
50
|
+
if key in Repository.images:
|
|
51
|
+
Repository.imshow(key, Repository.images[key])
|
|
52
|
+
else:
|
|
53
|
+
danger(f"No image found with key {key}")
|
|
54
|
+
|
|
55
|
+
if wait:
|
|
56
|
+
cv2.waitKey(0)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
from .classes.Repository import Repository
|
|
3
|
+
from .helpers import collection
|
|
4
|
+
import numpy
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def stack(*keys, **settings):
|
|
8
|
+
default_settings = {
|
|
9
|
+
"axis": 1,
|
|
10
|
+
"new_key": None
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
settings = {
|
|
14
|
+
**default_settings,
|
|
15
|
+
**settings
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
stacked_image = numpy.concatenate(
|
|
19
|
+
collection(keys).map(lambda key: Repository.images[key]),
|
|
20
|
+
axis=settings["axis"]
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
if settings["new_key"] is not None:
|
|
24
|
+
Repository.images[settings["new_key"]] = stacked_image
|
|
25
|
+
|
|
26
|
+
return stacked_image
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def vstack(*keys, **settings):
|
|
30
|
+
settings["axis"] = 1
|
|
31
|
+
return stack(*keys, **settings)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def hstack(*keys, **settings):
|
|
35
|
+
settings["axis"] = 0
|
|
36
|
+
return stack(*keys, **settings)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: homa
|
|
3
|
+
Version: 0.22
|
|
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=500
|
|
13
|
+
/>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<hr />
|
|
17
|
+
|
|
18
|
+
Homa is an easy way to start learning Computer Vision with OpenCV.
|
|
19
|
+
|
|
20
|
+
## Loading Images
|
|
21
|
+
|
|
22
|
+
Images could be loaded with the `image` helper, that accepts the file name and a key for the repository.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from homa import *
|
|
26
|
+
|
|
27
|
+
image("horse.jpg", "horse")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Alternatively, following code will load the file into the repository with a key of everything before the last in the filename.
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from homa import *
|
|
34
|
+
|
|
35
|
+
image("horse.jpg") # stored as "horse"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Smoothing
|
|
39
|
+
|
|
40
|
+
### Blur
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from homa import *
|
|
44
|
+
|
|
45
|
+
image("horse.jpg")
|
|
46
|
+
|
|
47
|
+
blur("horse", 7) # rewrites "horse" key
|
|
48
|
+
blur("horse", (7, 19)) # rewrites "horse" key
|
|
49
|
+
blur("horse", 9, "blurred horse") # as a new key in the repository
|
|
50
|
+
show("blurred horse")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Gaussian Blur
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from homa import *
|
|
57
|
+
|
|
58
|
+
image("horse.jpg")
|
|
59
|
+
|
|
60
|
+
gaussian("horse", 7) # rewrites "horse" key
|
|
61
|
+
gaussian("horse", (7, 19)) # rewrites "horse" key
|
|
62
|
+
gaussian("horse", 9, "gaussian blurred horse") # as a new key in the repository
|
|
63
|
+
show("gaussian blurred horse")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Stacking
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from homa import *
|
|
70
|
+
|
|
71
|
+
image("horse.jpg")
|
|
72
|
+
blur("horse", 9, "blurred horse")
|
|
73
|
+
|
|
74
|
+
show(
|
|
75
|
+
vstack("horse", "blurred horse"),
|
|
76
|
+
window="Vstacked"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
showWait(
|
|
80
|
+
hstack("horse", "blurred horse"),
|
|
81
|
+
window="Hstacked"
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Camera
|
|
86
|
+
|
|
87
|
+
Camera frames could be access from the repository with a key of `camera`.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from homa import *
|
|
91
|
+
|
|
92
|
+
for _ in camera():
|
|
93
|
+
show("camera")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
You can simply combine camera frames with the supported effects.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from homa import *
|
|
100
|
+
|
|
101
|
+
for _ in camera():
|
|
102
|
+
blur("camera", 13, "blurred camera")
|
|
103
|
+
|
|
104
|
+
show(
|
|
105
|
+
vstack("camera", "blurred camera"),
|
|
106
|
+
window="Camera Effect"
|
|
107
|
+
)
|
|
108
|
+
```
|
homa-0.21/PKG-INFO
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: homa
|
|
3
|
-
Version: 0.21
|
|
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.21/README.md
DELETED
homa-0.21/homa/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .main import *
|
homa-0.21/homa/main.py
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import cv2
|
|
2
|
-
import numpy
|
|
3
|
-
from typing import List
|
|
4
|
-
from .helpers import collection
|
|
5
|
-
from .helpers import danger
|
|
6
|
-
from .helpers import is_colab
|
|
7
|
-
|
|
8
|
-
from .classes.Repository import Repository
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def path(directory: str) -> None:
|
|
12
|
-
Repository.directory = directory
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def write(key: str, filename: str) -> None:
|
|
16
|
-
cv2.imwrite(
|
|
17
|
-
filename=filename,
|
|
18
|
-
img=Repository.images[key]
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def save(key: str, filename: str) -> None:
|
|
23
|
-
write(key, filename)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def image(filename: str, key: str | None = None, color: bool = True) -> None:
|
|
27
|
-
# TODO: add no extension in the file
|
|
28
|
-
if key is None:
|
|
29
|
-
key = filename
|
|
30
|
-
|
|
31
|
-
Repository.images[key] = cv2.imread(filename, int(color))
|
|
32
|
-
return Repository.images[key]
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def show(key: any = None) -> None:
|
|
36
|
-
# TODO: add functionality to distinguish between camera and images
|
|
37
|
-
|
|
38
|
-
if key is not None and not isinstance(key, str):
|
|
39
|
-
Repository.imshow(f"Window #{Repository.get_counter()}", key)
|
|
40
|
-
|
|
41
|
-
elif key is None:
|
|
42
|
-
for key, image in Repository.images.items():
|
|
43
|
-
Repository.imshow(key, image)
|
|
44
|
-
|
|
45
|
-
elif key is not None:
|
|
46
|
-
if key in Repository.images:
|
|
47
|
-
Repository.imshow(key, Repository.images[key])
|
|
48
|
-
else:
|
|
49
|
-
danger(f"No image found with key {key}")
|
|
50
|
-
|
|
51
|
-
cv2.waitKey(0)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def camera():
|
|
55
|
-
capture = cv2.VideoCapture()
|
|
56
|
-
_, frame = capture.read()
|
|
57
|
-
Repository.camera_frame = frame
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def stack(keys: List[str], new_key: str, axis: int):
|
|
61
|
-
Repository.images[new_key] = numpy.concatenate(
|
|
62
|
-
collection(keys).map(lambda key: Repository.images[key]),
|
|
63
|
-
axis=axis
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def vstack(keys: List[str], new_key: str) -> None:
|
|
68
|
-
stack(keys, new_key, 1)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def hstack(keys: List[str] | str, new_key: str | None = None):
|
|
72
|
-
if isinstance(keys, str) and new_key is None:
|
|
73
|
-
hstack([keys], keys)
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
stack(keys, new_key, 0)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def blur(key: str, kernel: int | List[int] = (7, 7), new_key: str | None = None):
|
|
80
|
-
if new_key is None:
|
|
81
|
-
new_key = key
|
|
82
|
-
|
|
83
|
-
if isinstance(kernel, int):
|
|
84
|
-
kernel = (kernel, kernel)
|
|
85
|
-
|
|
86
|
-
Repository.images[new_key] = cv2.blur(
|
|
87
|
-
Repository.images[key],
|
|
88
|
-
kernel
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def sigma(x: float = 0, y: float = 0):
|
|
93
|
-
Repository.sigmaX = x
|
|
94
|
-
Repository.sigmaY = y
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def gaussian(key: str, kernel: None | List[int] = None, new_key: str | None = None):
|
|
98
|
-
if new_key is None:
|
|
99
|
-
new_key = key
|
|
100
|
-
|
|
101
|
-
if isinstance(kernel, int):
|
|
102
|
-
kernel = (kernel, kernel)
|
|
103
|
-
|
|
104
|
-
Repository.images[new_key] = cv2.GaussianBlur(
|
|
105
|
-
Repository.images[key],
|
|
106
|
-
kernel,
|
|
107
|
-
sigmaX=Repository.sigmaX,
|
|
108
|
-
sigmaY=Repository.sigmaY
|
|
109
|
-
)
|
homa-0.21/homa.egg-info/PKG-INFO
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: homa
|
|
3
|
-
Version: 0.21
|
|
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.21 → homa-0.22}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{homa-0.21 → homa-0.22}/setup.py
RENAMED
|
File without changes
|