OTVision 0.5.3__py3-none-any.whl
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.
- OTVision/__init__.py +30 -0
- OTVision/application/__init__.py +0 -0
- OTVision/application/configure_logger.py +23 -0
- OTVision/application/detect/__init__.py +0 -0
- OTVision/application/detect/get_detect_cli_args.py +9 -0
- OTVision/application/detect/update_detect_config_with_cli_args.py +95 -0
- OTVision/application/get_config.py +25 -0
- OTVision/config.py +754 -0
- OTVision/convert/__init__.py +0 -0
- OTVision/convert/convert.py +318 -0
- OTVision/dataformat.py +70 -0
- OTVision/detect/__init__.py +0 -0
- OTVision/detect/builder.py +48 -0
- OTVision/detect/cli.py +166 -0
- OTVision/detect/detect.py +296 -0
- OTVision/detect/otdet.py +103 -0
- OTVision/detect/plugin_av/__init__.py +0 -0
- OTVision/detect/plugin_av/rotate_frame.py +37 -0
- OTVision/detect/yolo.py +277 -0
- OTVision/domain/__init__.py +0 -0
- OTVision/domain/cli.py +42 -0
- OTVision/helpers/__init__.py +0 -0
- OTVision/helpers/date.py +26 -0
- OTVision/helpers/files.py +538 -0
- OTVision/helpers/formats.py +139 -0
- OTVision/helpers/log.py +131 -0
- OTVision/helpers/machine.py +71 -0
- OTVision/helpers/video.py +54 -0
- OTVision/track/__init__.py +0 -0
- OTVision/track/iou.py +282 -0
- OTVision/track/iou_util.py +140 -0
- OTVision/track/preprocess.py +451 -0
- OTVision/track/track.py +422 -0
- OTVision/transform/__init__.py +0 -0
- OTVision/transform/get_homography.py +156 -0
- OTVision/transform/reference_points_picker.py +462 -0
- OTVision/transform/transform.py +352 -0
- OTVision/version.py +13 -0
- OTVision/view/__init__.py +0 -0
- OTVision/view/helpers/OTC.ico +0 -0
- OTVision/view/view.py +90 -0
- OTVision/view/view_convert.py +128 -0
- OTVision/view/view_detect.py +146 -0
- OTVision/view/view_helpers.py +417 -0
- OTVision/view/view_track.py +131 -0
- OTVision/view/view_transform.py +140 -0
- otvision-0.5.3.dist-info/METADATA +47 -0
- otvision-0.5.3.dist-info/RECORD +50 -0
- otvision-0.5.3.dist-info/WHEEL +4 -0
- otvision-0.5.3.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OTVision gui module for transform.py
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Copyright (C) 2022 OpenTrafficCam Contributors
|
|
6
|
+
# <https://github.com/OpenTrafficCam
|
|
7
|
+
# <team@opentrafficcam.org>
|
|
8
|
+
#
|
|
9
|
+
# This program is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
# (at your option) any later version.
|
|
13
|
+
#
|
|
14
|
+
# This program is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# GNU General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU General Public License
|
|
20
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
import logging
|
|
24
|
+
import shutil
|
|
25
|
+
import tkinter as tk
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
from tkinter import filedialog
|
|
28
|
+
|
|
29
|
+
from OTVision.config import CONFIG, PAD
|
|
30
|
+
from OTVision.helpers.files import get_files, replace_filetype
|
|
31
|
+
from OTVision.helpers.log import LOGGER_NAME
|
|
32
|
+
from OTVision.transform.reference_points_picker import ReferencePointsPicker
|
|
33
|
+
from OTVision.transform.transform import main as transform
|
|
34
|
+
from OTVision.transform.transform import write_refpts
|
|
35
|
+
from OTVision.view.view_helpers import FrameRun
|
|
36
|
+
|
|
37
|
+
log = logging.getLogger(LOGGER_NAME)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class FrameTransform(tk.LabelFrame):
|
|
41
|
+
def __init__(self, **kwargs):
|
|
42
|
+
super().__init__(**kwargs)
|
|
43
|
+
self.frame_options = FrameTransformOptions(master=self)
|
|
44
|
+
self.frame_options.pack(**PAD, fill="x", expand=1, anchor="n")
|
|
45
|
+
self.frame_run = FrameRunTransformation(master=self)
|
|
46
|
+
self.frame_run.pack(**PAD, side="left", fill="both", expand=1, anchor="s")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class FrameTransformOptions(tk.Frame):
|
|
50
|
+
def __init__(self, **kwargs):
|
|
51
|
+
super().__init__(**kwargs)
|
|
52
|
+
|
|
53
|
+
# Reference points
|
|
54
|
+
self.button_choose_refpts = tk.Button(
|
|
55
|
+
master=self, text="Choose reference points for selected", state=tk.DISABLED
|
|
56
|
+
)
|
|
57
|
+
self.button_choose_refpts.grid(row=0, column=0, columnspan=2, sticky="ew")
|
|
58
|
+
self.button_choose_refpts.bind("<ButtonRelease-1>", self.choose_refpts)
|
|
59
|
+
self.button_click_refpts = tk.Button(
|
|
60
|
+
master=self, text="New reference points", state=tk.DISABLED
|
|
61
|
+
)
|
|
62
|
+
self.button_click_refpts.grid(row=1, column=0, columnspan=2, sticky="ew")
|
|
63
|
+
self.button_click_refpts.bind("<ButtonRelease-1>", self.click_refpts)
|
|
64
|
+
|
|
65
|
+
# Overwrite
|
|
66
|
+
self.checkbutton_overwrite_var = tk.BooleanVar()
|
|
67
|
+
self.checkbutton_overwrite = tk.Checkbutton(
|
|
68
|
+
master=self,
|
|
69
|
+
text="Overwrite existing tracks",
|
|
70
|
+
variable=self.checkbutton_overwrite_var,
|
|
71
|
+
)
|
|
72
|
+
self.checkbutton_overwrite.grid(row=4, column=0, columnspan=2, sticky="w")
|
|
73
|
+
if CONFIG["TRANSFORM"]["OVERWRITE"]:
|
|
74
|
+
self.checkbutton_overwrite.select()
|
|
75
|
+
|
|
76
|
+
def choose_refpts(self, event): # sourcery skip: use-named-expression
|
|
77
|
+
# Get selected files from files frame
|
|
78
|
+
selected_files = self.master.master.frame_files.get_selected_files()
|
|
79
|
+
|
|
80
|
+
if selected_files:
|
|
81
|
+
log.debug("choose refpts file for selected files")
|
|
82
|
+
|
|
83
|
+
# Show filedialog
|
|
84
|
+
refpts_file = filedialog.askopenfilename(
|
|
85
|
+
title="Select a reference points files",
|
|
86
|
+
filetypes=[(".otrfpts", ".otrfpts")],
|
|
87
|
+
initialdir=Path(selected_files[0]).parent,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Check paths
|
|
91
|
+
refpts_file = get_files(paths=[refpts_file])[0]
|
|
92
|
+
log.debug(refpts_file)
|
|
93
|
+
|
|
94
|
+
# Copy refpts file for all selected
|
|
95
|
+
for selected_file in selected_files:
|
|
96
|
+
new_refpts_file = Path(selected_file).with_suffix(".otrfpts")
|
|
97
|
+
try:
|
|
98
|
+
shutil.copy2(refpts_file, new_refpts_file)
|
|
99
|
+
except shutil.SameFileError:
|
|
100
|
+
continue
|
|
101
|
+
|
|
102
|
+
# Update dict and treeview in files frame
|
|
103
|
+
self.master.master.frame_files.update_files_dict()
|
|
104
|
+
|
|
105
|
+
def click_refpts(self, event):
|
|
106
|
+
if selected_files := self.master.master.frame_files.get_selected_files():
|
|
107
|
+
log.debug("click and save refpts for selected files")
|
|
108
|
+
|
|
109
|
+
if refpts := ReferencePointsPicker(
|
|
110
|
+
video_file=Path(selected_files[0])
|
|
111
|
+
).refpts:
|
|
112
|
+
# Save refpts for all selected files
|
|
113
|
+
for selected_file in selected_files:
|
|
114
|
+
new_refpts_file = Path(selected_file).with_suffix(".otrfpts")
|
|
115
|
+
write_refpts(refpts=refpts, refpts_file=new_refpts_file)
|
|
116
|
+
|
|
117
|
+
# Update dict and treeview in files frame
|
|
118
|
+
self.master.master.frame_files.update_files_dict()
|
|
119
|
+
else:
|
|
120
|
+
log.debug("No files selected")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class FrameRunTransformation(FrameRun):
|
|
124
|
+
def __init__(self, **kwargs):
|
|
125
|
+
super().__init__(**kwargs)
|
|
126
|
+
self.button_run.bind("<ButtonRelease-1>", self.run)
|
|
127
|
+
if CONFIG["TRANSFORM"]["RUN_CHAINED"]:
|
|
128
|
+
self.checkbutton_run_chained.select()
|
|
129
|
+
|
|
130
|
+
def run(self, event):
|
|
131
|
+
tracks_files = replace_filetype(
|
|
132
|
+
files=self.master.master.frame_files.get_tree_files(),
|
|
133
|
+
new_filetype=CONFIG["DEFAULT_FILETYPE"]["TRACK"],
|
|
134
|
+
)
|
|
135
|
+
tracks_files = get_files(
|
|
136
|
+
paths=tracks_files,
|
|
137
|
+
filetypes=[CONFIG["DEFAULT_FILETYPE"]["TRACK"]],
|
|
138
|
+
)
|
|
139
|
+
log.info("Call transform from GUI")
|
|
140
|
+
transform(paths=tracks_files)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OTVision
|
|
3
|
+
Version: 0.5.3
|
|
4
|
+
Summary: OTVision is a core module of the OpenTrafficCam framework to perform object detection and tracking.
|
|
5
|
+
Project-URL: Homepage, https://opentrafficcam.org/
|
|
6
|
+
Project-URL: Documentation, https://opentrafficcam.org/overview/
|
|
7
|
+
Project-URL: Repository, https://github.com/OpenTrafficCam/OTVision
|
|
8
|
+
Project-URL: Issues, https://github.com/OpenTrafficCam/OTVision/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/OpenTrafficCam/OTVision/releases
|
|
10
|
+
Author-email: OpenTrafficCam contributors <team@opentrafficcam.org>, platomo GmbH <info@platomo.de>
|
|
11
|
+
License-Expression: GPL-3.0-only
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: OpenTrafficCam,Traffic Analysis,Traffic Counting,Trajectories
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: av==13.0.0
|
|
20
|
+
Requires-Dist: fire==0.7.0
|
|
21
|
+
Requires-Dist: geopandas==1.0.1
|
|
22
|
+
Requires-Dist: ijson==3.3.0
|
|
23
|
+
Requires-Dist: moviepy==1.0.3
|
|
24
|
+
Requires-Dist: numpy==1.26.4
|
|
25
|
+
Requires-Dist: opencv-python==4.9.0.80
|
|
26
|
+
Requires-Dist: pandas==2.2.2
|
|
27
|
+
Requires-Dist: pyyaml==6.0.2
|
|
28
|
+
Requires-Dist: setuptools==74.0.0
|
|
29
|
+
Requires-Dist: torch==2.3.1
|
|
30
|
+
Requires-Dist: torchvision==0.18.1
|
|
31
|
+
Requires-Dist: tqdm==4.66.5
|
|
32
|
+
Requires-Dist: ujson==5.10.0
|
|
33
|
+
Requires-Dist: ultralytics==8.3.74
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# OTVision
|
|
37
|
+
|
|
38
|
+
OTVision is a core module of the [OpenTrafficCam framework](https://github.com/OpenTrafficCam) to detect and track objects (road users) in videos recorded by [OTCamera](https://github.com/OpenTrafficCam/OTCamera) or other camera systems. On the resulting trajectories, one can perform traffic analysis using [OTAnalytics](https://github.com/OpenTrafficCam/OTAnalytics).
|
|
39
|
+
|
|
40
|
+
Check out the [documentation](https://opentrafficcam.org/OTVision/) for detailed instructions on how to install and use OTVision.
|
|
41
|
+
|
|
42
|
+
We appreciate your support in the form of both code and comments. First, please have a look at the [contribute](https://opentrafficcam.org/contribute) section of the OpenTrafficCam documentation.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
This software is licensed under the [GPL-3.0 License](LICENSE)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
OTVision/__init__.py,sha256=b2goS-TYrN9y8WHmjG22z1oVwCrjV0WtGJE32NJfvJM,1042
|
|
2
|
+
OTVision/config.py,sha256=qCCg2MT_exTiTqEXq3pdqjhlfzQCg4yKKcGJSr7Wkp0,21951
|
|
3
|
+
OTVision/dataformat.py,sha256=atssfeVcwXBjysXbVsgMbmtdMiChWzu8AwW4hK4GZw4,1884
|
|
4
|
+
OTVision/version.py,sha256=rRi91utnulgYKaZW-qxdRDD7ufdJJ0G1IesKOtXP-NE,175
|
|
5
|
+
OTVision/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
OTVision/application/configure_logger.py,sha256=RmRgYkvSXWqpFX3N2n0h2LDna3uL8AY-yfVZU66t5q4,611
|
|
7
|
+
OTVision/application/get_config.py,sha256=fRJZUWJvlTed6qriw82-B-05CAqfBma6NQ23WrKqYdE,771
|
|
8
|
+
OTVision/application/detect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
OTVision/application/detect/get_detect_cli_args.py,sha256=gezr17im8SwbuXW1suCodWRrFs8lSljNKu76SbWBgkY,265
|
|
10
|
+
OTVision/application/detect/update_detect_config_with_cli_args.py,sha256=PxKosSR_4tlgJ-WpixrYHJJjUITpHGcD8ct9Fggpcys,3550
|
|
11
|
+
OTVision/convert/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
OTVision/convert/convert.py,sha256=vRIFcrAUf9MUWAuvF_q7JQ9aN89B1ouBOCtXrCLuDp8,11013
|
|
13
|
+
OTVision/detect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
OTVision/detect/builder.py,sha256=opd3RQ8ycm9Z75Z4OUiDXfP02bHvDslJcsfeKmLDwkw,1615
|
|
15
|
+
OTVision/detect/cli.py,sha256=HpvdaXl_IJZe0CxZ9KmGzYDLL-zFABmfSV8aG3Rtamo,5454
|
|
16
|
+
OTVision/detect/detect.py,sha256=O8xo0yH9yCmQKkvVqxkoJxQ9FcRPyf3s6IesgdEXcdo,10968
|
|
17
|
+
OTVision/detect/otdet.py,sha256=rIiZR1J0_xdTVc6fwu8n2CrsIwpuD4TQiI6o99RTjog,3456
|
|
18
|
+
OTVision/detect/yolo.py,sha256=cxRUxIchy_KYxkYUHEYyBCM4PB7d6E_nUDk0fja6XJY,9181
|
|
19
|
+
OTVision/detect/plugin_av/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
OTVision/detect/plugin_av/rotate_frame.py,sha256=4wJqTYI2HRlfa4p2Ffap33vLmKIzE_EwFvQraEkQ4R8,1055
|
|
21
|
+
OTVision/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
OTVision/domain/cli.py,sha256=RbcgaqULJuzYGG36970EYAxKoiLdBbGn2rX-JHpaH40,1000
|
|
23
|
+
OTVision/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
OTVision/helpers/date.py,sha256=XK0fmXMombQ2CJ2_RXjk-bc-R8qqXRK2rDmCMBi0_G0,854
|
|
25
|
+
OTVision/helpers/files.py,sha256=JxO0ijcybBgIijIuA-9fnNhy-No0FAZCaE4RKMW0ie0,18116
|
|
26
|
+
OTVision/helpers/formats.py,sha256=YLo_QLA2nhVREyv5N-xNW20c4nIL7DIF40E1lrsAyLE,4365
|
|
27
|
+
OTVision/helpers/log.py,sha256=s5EYBboiNrkIKQE7WkPxnC0NJFL_shH7L5p7AI9IGJE,4544
|
|
28
|
+
OTVision/helpers/machine.py,sha256=8Bz_Eg7PS0IL4riOVeJcEIi5D9E8Ju8-JomTkW975p8,2166
|
|
29
|
+
OTVision/helpers/video.py,sha256=ZXG1rhD9OVk95mnfYVPbBwLKrRturgSRCsaOsGJVT2U,1324
|
|
30
|
+
OTVision/track/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
+
OTVision/track/iou.py,sha256=zpb4TbB34wZjUorhMLqMy6WspfsK-TkYvD75L-_ODM8,9491
|
|
32
|
+
OTVision/track/iou_util.py,sha256=mqylrarqiauSewinxOm9CSa6dgVSl8G9bpCv--2m02M,4465
|
|
33
|
+
OTVision/track/preprocess.py,sha256=P7w6N5OwIzdoDNwP5QcHHxRXwy0_ITz5Nkpk_P34UVs,14120
|
|
34
|
+
OTVision/track/track.py,sha256=fKDP6jQ2pDLwxJOiDUYqs9fD3W67fNgwO3l8zUTYOw4,15344
|
|
35
|
+
OTVision/transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
+
OTVision/transform/get_homography.py,sha256=29waW61uzCCB7tlBAS2zck9sliAxZqnjjOa4jOOHHIc,5970
|
|
37
|
+
OTVision/transform/reference_points_picker.py,sha256=LOmwzCaqbJnXVhaTSaZtkCzTMDamYjbTpY8I99pN0rg,16578
|
|
38
|
+
OTVision/transform/transform.py,sha256=cv8HIX-uPYVQWLGHU-8OrkQjJ2cOh3GIZ13wqeI431w,12455
|
|
39
|
+
OTVision/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
+
OTVision/view/view.py,sha256=sBFGfr-lf8lG1BTaQ3Iu46GpZGhaVhSrqg8p5XUPJ4I,3302
|
|
41
|
+
OTVision/view/view_convert.py,sha256=NUtmrmAAFCYdQS1U2av_eYUScXugQYjhD3e3H0pro6Q,5157
|
|
42
|
+
OTVision/view/view_detect.py,sha256=E1JP9w5iv44hYkOr86In5d6V3sgn7Ld85KaRcY0oFZU,5951
|
|
43
|
+
OTVision/view/view_helpers.py,sha256=a5yV_6ZxO5bxsSymOmxdHqzOEv0VFq4wFBopVRGuVRo,16195
|
|
44
|
+
OTVision/view/view_track.py,sha256=ioHenonuTJQn8yDzlIDV8Jc1yzWA0GHbC9CotYGtxHQ,5389
|
|
45
|
+
OTVision/view/view_transform.py,sha256=HvRd8g8geKRy0OoiZUDn_oC3SJC5nuXhZf3uZelfGKg,5473
|
|
46
|
+
OTVision/view/helpers/OTC.ico,sha256=G9kwlDtgBXmXO3yxW6Z-xVFV2q4nUGuz9E1VPHSu_I8,21662
|
|
47
|
+
otvision-0.5.3.dist-info/METADATA,sha256=y9bE7wsK_cHxpU9EmFkdbuPdkaxB4PbbHgGvZTTE5AA,2244
|
|
48
|
+
otvision-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
49
|
+
otvision-0.5.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
50
|
+
otvision-0.5.3.dist-info/RECORD,,
|