python-camera-manager-directshow 0.1.0__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.
@@ -0,0 +1,239 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-camera-manager-directshow
3
+ Version: 0.1.0
4
+ Summary: Python camera manager with DirectShow capability discovery and .NET bridge integration
5
+ Author: Lior Blokshtein
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/LBlokshtein/python-camera-manager-directshow.git
8
+ Project-URL: Repository, https://github.com/LBlokshtein/python-camera-manager-directshow.git
9
+ Keywords: camera,directshow,pythonnet,opencv,computer-vision
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Topic :: Multimedia :: Video :: Capture
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: pythonnet
22
+ Requires-Dist: opencv-python
23
+ Requires-Dist: Pillow
24
+ Dynamic: license-file
25
+
26
+ # Python Camera Manager (DirectShow Bridge)
27
+
28
+ A Python-first camera control and preview application built on top of a .NET DirectShow wrapper.
29
+
30
+ This project was created to solve a common limitation in OpenCV camera workflows: while OpenCV can open cameras quickly, it does not provide a reliable, discoverable, device-specific model of control capabilities (valid ranges, step sizes, defaults, and auto/manual support) across many webcams.
31
+
32
+ This codebase provides that missing layer:
33
+
34
+ - discover camera capabilities and supported formats using DirectShow
35
+ - expose those capabilities as plain Python data structures
36
+ - open and stream camera frames through the same API
37
+ - optionally use this metadata with another capture backend (for example OpenCV)
38
+
39
+ ## Why This Project Exists
40
+
41
+ In many practical camera applications, you need to know more than whether a property exists. You need to know:
42
+
43
+ - minimum and maximum values
44
+ - step increments
45
+ - default values
46
+ - current values
47
+ - whether auto mode is supported
48
+ - whether auto mode is currently enabled
49
+
50
+ OpenCV alone does not consistently provide this level of introspection across devices and drivers. This project addresses that gap by using DirectShow (via a .NET wrapper) for capability discovery and control, then exposing a clean Python API for application code.
51
+
52
+ ## Core Design
53
+
54
+ ### .NET for camera graph and capability access
55
+
56
+ The .NET layer (`DirectShowLibWrapper.dll`) handles DirectShow-specific operations such as:
57
+
58
+ - camera enumeration
59
+ - supported format discovery
60
+ - capability/range discovery
61
+ - frame acquisition
62
+ - camera property set/get with auto/manual modes
63
+
64
+ ### Python bridge for usability
65
+
66
+ The Python bridge files:
67
+
68
+ - `camera/camera_inspector_bridge.py`
69
+ - `camera/camera_device_bridge.py`
70
+
71
+ load the .NET assemblies and call into the wrapper.
72
+
73
+ ### Python manager for developer experience
74
+
75
+ `camera/camera_manager.py` is the high-level facade.
76
+
77
+ It converts .NET objects into Python-native types (`NamedTuple`, `dict`, `list`) so downstream code does not need to work with .NET object syntax. The output is intentionally Pythonic and user-friendly.
78
+
79
+ In other words, consumers can use the API without needing to understand .NET interop details.
80
+
81
+ ## What You Can Do With It
82
+
83
+ 1. Full managed workflow
84
+ - discover devices, formats, ranges
85
+ - open camera and stream frames
86
+ - change auto/manual modes
87
+ - set precise property values based on discovered constraints
88
+ - format note: without OpenCV installed, streaming requires uncompressed formats (for example RGB24/BGR24/GRAY8). MJPG and YUY2 decoding paths require OpenCV.
89
+
90
+ 2. Hybrid workflow
91
+ - use this project only for camera capability discovery (ranges, steps, auto support)
92
+ - then open/stream with another backend (such as OpenCV) if preferred
93
+
94
+ This gives you flexibility to mix tooling while still relying on robust capability metadata.
95
+
96
+ ## Repository Structure
97
+
98
+ ```text
99
+
100
+ app/
101
+ main.py # Main runnable application entrypoint
102
+ camera/
103
+ __init__.py
104
+ camera_manager.py # High-level Python API and cache
105
+ camera_device_bridge.py # Frame/camera control bridge into .NET
106
+ camera_inspector_bridge.py # Camera discovery/capability bridge into .NET
107
+ GUI/
108
+ main_GUI.py # Tkinter UI
109
+ runtime/
110
+ dotnet/
111
+ DirectShowLib.dll
112
+ DirectShowLibWrapper.dll
113
+ ```
114
+
115
+ ## Requirements
116
+
117
+ - Windows (DirectShow)
118
+ - Python 3.10+ (recommended)
119
+ - .NET runtime compatible with your `DirectShowLibWrapper.dll`
120
+ - A DirectShow-capable camera device
121
+
122
+ Python packages:
123
+
124
+ - `pythonnet`
125
+ - `opencv-python` (required for MJPG and YUY2 decode paths)
126
+ - `Pillow`
127
+
128
+ Streaming without OpenCV is supported only when the camera output is already an uncompressed format handled by the bridge (for example `RGB24`, `BGR24`, or `GRAY8`).
129
+
130
+ ## Setup
131
+
132
+ Install from PyPI (after package publication):
133
+
134
+ ```bash
135
+ pip install python-camera-manager-directshow
136
+ ```
137
+
138
+ Install from source (current repository):
139
+
140
+ ```bash
141
+ python -m venv .venv
142
+ .venv\Scripts\activate
143
+ pip install pythonnet opencv-python Pillow
144
+ ```
145
+
146
+ Ensure these assemblies exist:
147
+
148
+ - `runtime/dotnet/DirectShowLib.dll`
149
+ - `runtime/dotnet/DirectShowLibWrapper.dll`
150
+
151
+ ## Run
152
+
153
+ ```bash
154
+ python -m app.main
155
+ ```
156
+
157
+ Alternative:
158
+
159
+ ```bash
160
+ python app/main.py
161
+ ```
162
+
163
+ ## API Example (Python-native usage)
164
+
165
+ ```python
166
+ from camera.camera_manager import Camera
167
+
168
+ # Discover all cameras with formats and control ranges
169
+ devices = Camera.get_connected_cameras(get_formats=True, get_ranges=True)
170
+
171
+ if not devices:
172
+ raise RuntimeError("No camera detected")
173
+
174
+ selected = devices[0]
175
+ fmt = selected.formats[0]
176
+
177
+ cam = Camera(debug_logging=False)
178
+ cam.open(selected.path, fmt, request_rgb24_conversion=False)
179
+
180
+ # Ranges are plain Python structures
181
+ ranges = cam.property_ranges
182
+ exposure = ranges.get("Exposure")
183
+ if exposure and exposure.property_supported:
184
+ # Respect discovered min/max/step
185
+ cam.set_property_auto_mode("Exposure", False)
186
+ cam.set_property_value("Exposure", int(exposure.default))
187
+
188
+ ok, frame = cam.get_frame()
189
+ cam.close()
190
+ ```
191
+
192
+ ## Hybrid Example (Use metadata here, capture elsewhere)
193
+
194
+ ```python
195
+ import cv2
196
+ from camera.camera_manager import Camera
197
+
198
+ devices = Camera.get_connected_cameras(get_formats=False, get_ranges=True)
199
+ if not devices:
200
+ raise RuntimeError("No camera")
201
+
202
+ # Use discovered ranges for UI/validation logic
203
+ ranges = devices[0].ranges
204
+ print(ranges.get("Exposure"))
205
+
206
+ # Open camera with another backend if desired
207
+ cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
208
+ ret, frame = cap.read()
209
+ cap.release()
210
+ ```
211
+
212
+ ## Notes for Recruiters / Reviewers
213
+
214
+ This project demonstrates:
215
+
216
+ - cross-language integration (.NET DirectShow + Python)
217
+ - practical camera systems engineering
218
+ - robust control-surface modeling (ranges, steps, auto/manual capabilities)
219
+ - Python API design that hides interop complexity
220
+ - real-time GUI integration and format negotiation
221
+
222
+ ## Limitations
223
+
224
+ - Device behavior depends on camera driver and hardware implementation.
225
+ - Some controls may be unsupported or partially supported on specific devices.
226
+ - Only one process/backend should actively own a camera stream at a time.
227
+ - MJPG and YUY2 decoding require OpenCV in the current implementation; without OpenCV, use uncompressed output formats.
228
+
229
+ ## Companion .NET Repository
230
+
231
+ The .NET wrapper source code is maintained in a separate repository:
232
+
233
+ - https://github.com/LBlokshtein/DirectShowLibWrapper
234
+
235
+ This Python repository consumes the compiled artifacts and focuses on Python API ergonomics and application usage.
236
+
237
+ ## License
238
+
239
+ MIT. See `LICENSE`.
@@ -0,0 +1,18 @@
1
+ GUI/__init__.py,sha256=5ORv_CAOI7g_FJyIXn5NkbybEKoa2-fOUda8fOiIm4E,64
2
+ GUI/main_GUI.py,sha256=M5OEVPWKoBUnpKgcYjmq2mo3LysV_V2VOadvV_kPrcw,39705
3
+ app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ app/main.py,sha256=4l97Wh6Kz4d9KfkitfwE7pB_uneTGHHmPYviaQSZt1c,3304
5
+ camera/__init__.py,sha256=DNaYXuH4E8XTnTDVUR217Iw3Ijzs7WWF8iqWjFK0bqA,227
6
+ camera/camera_device_bridge.py,sha256=nTMbwNTFi8DbEwy-q9g4gGc9KtWmTB8kyjE40Xf1YiI,54048
7
+ camera/camera_inspector_bridge.py,sha256=Ugh5BfI5Fzryl48PBu3MzgjQrjyXb94bDO_YtU_SGkE,1781
8
+ camera/camera_manager.py,sha256=SX9xogRQhi3K7ROT7NKCSa9rKahG7KzcP2zcNUUJSTg,40418
9
+ python_camera_manager_directshow-0.1.0.dist-info/licenses/LICENSE,sha256=JwhXJ0q2mbWl5x8JFZ_t73TfZZi090M34vkkP6KsB2s,1093
10
+ runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ runtime/dotnet/DirectShowLib.dll,sha256=a-Vjg86DmC9piMcAAVr6PVBkG6abSNDwKTKiJgIq_FY,294912
12
+ runtime/dotnet/DirectShowLibWrapper.dll,sha256=fl5TDBoC_suceKznwpjjX9koVuyHtzkWl8tzAkBObaM,36352
13
+ runtime/dotnet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ python_camera_manager_directshow-0.1.0.dist-info/METADATA,sha256=Pe7XM-eidHQ3t5ezrPssTDNzTmCC03JpKR8-vR9jZ9c,7742
15
+ python_camera_manager_directshow-0.1.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
16
+ python_camera_manager_directshow-0.1.0.dist-info/entry_points.txt,sha256=bSzCSCUgYi3ypOcJhk3LUvJbu3rU7j72ig7nijgGUcI,49
17
+ python_camera_manager_directshow-0.1.0.dist-info/top_level.txt,sha256=gdFqPcJYq8TO7tRKRMXAEKgAvC1vwao8g_U8BHgK3AY,23
18
+ python_camera_manager_directshow-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ camera-manager = app.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lior Blokshtein
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.
@@ -0,0 +1,4 @@
1
+ GUI
2
+ app
3
+ camera
4
+ runtime
runtime/__init__.py ADDED
File without changes
Binary file
Binary file
File without changes