filter-faceblur 1.1.1__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.
- filter_faceblur/__init__.py +3 -0
- filter_faceblur/filter.py +319 -0
- filter_faceblur-1.1.1.dist-info/METADATA +131 -0
- filter_faceblur-1.1.1.dist-info/RECORD +7 -0
- filter_faceblur-1.1.1.dist-info/WHEEL +5 -0
- filter_faceblur-1.1.1.dist-info/licenses/LICENSE +201 -0
- filter_faceblur-1.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import logging, os
|
|
2
|
+
from typing import Dict
|
|
3
|
+
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
from openfilter.filter_runtime.filter import FilterConfig, Filter, Frame
|
|
7
|
+
from dotenv import load_dotenv
|
|
8
|
+
load_dotenv() # take environment variables from .env.
|
|
9
|
+
|
|
10
|
+
# Read the environment variables and provide default values if they are not present
|
|
11
|
+
MODEL_ARTIFACTORY_URL = os.getenv(
|
|
12
|
+
"MODEL_ARTIFACTORY_URL", "https://github.com/opencv/opencv_zoo/raw/main/models/face_detection_yunet/"
|
|
13
|
+
)
|
|
14
|
+
MODEL_ARTIFACT_NAME = os.getenv(
|
|
15
|
+
"MODEL_ARTIFACT_NAME", "face_detection_yunet_2023mar.onnx"
|
|
16
|
+
)
|
|
17
|
+
DETECTOR_NAME = os.getenv(
|
|
18
|
+
"DETECTOR_NAME", "yunet"
|
|
19
|
+
)
|
|
20
|
+
BLURRER_NAME = os.getenv(
|
|
21
|
+
"BLURRER_NAME", "gaussian"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = ['FilterFaceblurConfig', 'FilterFaceblur']
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class FilterFaceblurConfig(FilterConfig):
|
|
30
|
+
"""Configuration for the Face Blur filter."""
|
|
31
|
+
detector_name: str = "yunet"
|
|
32
|
+
blurrer_name: str = "gaussian"
|
|
33
|
+
model_artifactory_url: str = "https://github.com/opencv/opencv_zoo/raw/main/models/face_detection_yunet/"
|
|
34
|
+
model_artifact_name: str = "face_detection_yunet_2023mar.onnx"
|
|
35
|
+
blur_strength: float = 1.0
|
|
36
|
+
blur_enabled: bool = True # Enable/disable face blurring
|
|
37
|
+
detection_confidence_threshold: float = 0.25 # Minimum confidence for face detection
|
|
38
|
+
debug: bool = False
|
|
39
|
+
forward_upstream_data: bool = True # Forward data from upstream filters
|
|
40
|
+
include_face_coordinates: bool = True # Include face detection coordinates in frame data
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class FilterFaceblur(Filter):
|
|
44
|
+
"""
|
|
45
|
+
A filter that detects and blurs faces in video frames using OpenCV's YuNet face detector.
|
|
46
|
+
|
|
47
|
+
Features:
|
|
48
|
+
- Face detection using YuNet model
|
|
49
|
+
- Gaussian blur for face anonymization (configurable strength)
|
|
50
|
+
- Option to disable blurring while still detecting faces
|
|
51
|
+
- Configurable blur strength and confidence threshold
|
|
52
|
+
- Support for different detector and blurrer types
|
|
53
|
+
- Forward data from upstream filters (configurable)
|
|
54
|
+
- Face coordinates and detection metadata in frame data (configurable)
|
|
55
|
+
- Multi-topic processing (processes all image topics)
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def normalize_config(cls, config: FilterFaceblurConfig):
|
|
60
|
+
"""
|
|
61
|
+
Convert environment variables to correct data types, apply checks, etc.
|
|
62
|
+
"""
|
|
63
|
+
# Call parent class normalize_config first to handle sources/outputs parsing
|
|
64
|
+
config = super().normalize_config(config)
|
|
65
|
+
|
|
66
|
+
# Handle nested config structure
|
|
67
|
+
if isinstance(config, dict) and 'config' in config:
|
|
68
|
+
config = config['config']
|
|
69
|
+
|
|
70
|
+
# Load environment variables if config is empty or missing values
|
|
71
|
+
if isinstance(config, dict):
|
|
72
|
+
# Load from environment variables if not provided in config
|
|
73
|
+
env_mapping = {
|
|
74
|
+
'detector_name': str,
|
|
75
|
+
'blurrer_name': str,
|
|
76
|
+
'model_artifactory_url': str,
|
|
77
|
+
'model_artifact_name': str,
|
|
78
|
+
'blur_strength': float,
|
|
79
|
+
'blur_enabled': str,
|
|
80
|
+
'detection_confidence_threshold': float,
|
|
81
|
+
'debug': str,
|
|
82
|
+
'forward_upstream_data': str,
|
|
83
|
+
'include_face_coordinates': str,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for key, expected_type in env_mapping.items():
|
|
87
|
+
env_key = f"FILTER_{key.upper()}"
|
|
88
|
+
if key not in config and env_key in os.environ:
|
|
89
|
+
env_val = os.environ[env_key]
|
|
90
|
+
if expected_type is float:
|
|
91
|
+
config[key] = float(env_val)
|
|
92
|
+
elif expected_type is str and key in ['debug', 'forward_upstream_data', 'include_face_coordinates', 'blur_enabled']:
|
|
93
|
+
if env_val.lower() not in ['true', 'false']:
|
|
94
|
+
raise ValueError(f"Invalid {key} mode: {env_val}. It should be True or False.")
|
|
95
|
+
config[key] = env_val.lower() == 'true'
|
|
96
|
+
else:
|
|
97
|
+
config[key] = env_val
|
|
98
|
+
|
|
99
|
+
# Convert numeric strings to proper types
|
|
100
|
+
if 'blur_strength' in config and isinstance(config['blur_strength'], str):
|
|
101
|
+
config['blur_strength'] = float(config['blur_strength'])
|
|
102
|
+
if 'detection_confidence_threshold' in config and isinstance(config['detection_confidence_threshold'], str):
|
|
103
|
+
config['detection_confidence_threshold'] = float(config['detection_confidence_threshold'])
|
|
104
|
+
if 'debug' in config and isinstance(config['debug'], str):
|
|
105
|
+
if config['debug'].lower() not in ['true', 'false']:
|
|
106
|
+
raise ValueError(f"Invalid debug mode: {config['debug']}. It should be True or False.")
|
|
107
|
+
config['debug'] = config['debug'].lower() == 'true'
|
|
108
|
+
if 'forward_upstream_data' in config and isinstance(config['forward_upstream_data'], str):
|
|
109
|
+
config['forward_upstream_data'] = config['forward_upstream_data'].lower() == 'true'
|
|
110
|
+
if 'include_face_coordinates' in config and isinstance(config['include_face_coordinates'], str):
|
|
111
|
+
config['include_face_coordinates'] = config['include_face_coordinates'].lower() == 'true'
|
|
112
|
+
if 'blur_enabled' in config and isinstance(config['blur_enabled'], str):
|
|
113
|
+
if config['blur_enabled'].lower() not in ['true', 'false']:
|
|
114
|
+
raise ValueError(f"Invalid blur_enabled mode: {config['blur_enabled']}. It should be True or False.")
|
|
115
|
+
config['blur_enabled'] = config['blur_enabled'].lower() == 'true'
|
|
116
|
+
|
|
117
|
+
# Convert to FilterFaceblurConfig
|
|
118
|
+
config = FilterFaceblurConfig(**config)
|
|
119
|
+
|
|
120
|
+
# Validate detector name
|
|
121
|
+
valid_detectors = ['yunet', 'haar', 'dnn']
|
|
122
|
+
if config.detector_name not in valid_detectors:
|
|
123
|
+
raise ValueError(f"Invalid detector_name: {config.detector_name}. Must be one of {valid_detectors}")
|
|
124
|
+
|
|
125
|
+
# Validate blurrer name
|
|
126
|
+
valid_blurrers = ['gaussian', 'box', 'median']
|
|
127
|
+
if config.blurrer_name not in valid_blurrers:
|
|
128
|
+
raise ValueError(f"Invalid blurrer_name: {config.blurrer_name}. Must be one of {valid_blurrers}")
|
|
129
|
+
|
|
130
|
+
# Validate blur strength (allow 0 for disabling blur)
|
|
131
|
+
if config.blur_strength < 0:
|
|
132
|
+
raise ValueError("Blur strength must be non-negative")
|
|
133
|
+
|
|
134
|
+
# Validate detection confidence threshold
|
|
135
|
+
if not 0 <= config.detection_confidence_threshold <= 1:
|
|
136
|
+
raise ValueError("Detection confidence threshold must be between 0 and 1")
|
|
137
|
+
|
|
138
|
+
# Validate debug mode
|
|
139
|
+
if not isinstance(config.debug, bool):
|
|
140
|
+
raise ValueError(f"Invalid debug mode: {config.debug}. It should be True or False.")
|
|
141
|
+
|
|
142
|
+
# Validate forward_upstream_data mode
|
|
143
|
+
if not isinstance(config.forward_upstream_data, bool):
|
|
144
|
+
raise ValueError(f"Invalid forward_upstream_data mode: {config.forward_upstream_data}. It should be True or False.")
|
|
145
|
+
|
|
146
|
+
# Validate include_face_coordinates mode
|
|
147
|
+
if not isinstance(config.include_face_coordinates, bool):
|
|
148
|
+
raise ValueError(f"Invalid include_face_coordinates mode: {config.include_face_coordinates}. It should be True or False.")
|
|
149
|
+
|
|
150
|
+
# Validate blur_enabled mode
|
|
151
|
+
if not isinstance(config.blur_enabled, bool):
|
|
152
|
+
raise ValueError(f"Invalid blur_enabled mode: {config.blur_enabled}. It should be True or False.")
|
|
153
|
+
|
|
154
|
+
return config
|
|
155
|
+
|
|
156
|
+
def setup(self, config):
|
|
157
|
+
from filter_faceblur.model import FaceBlur
|
|
158
|
+
|
|
159
|
+
# Store config
|
|
160
|
+
self.config = config
|
|
161
|
+
|
|
162
|
+
# Use config parameters or fall back to environment variables
|
|
163
|
+
model_artifactory_url = getattr(config, 'model_artifactory_url', MODEL_ARTIFACTORY_URL)
|
|
164
|
+
model_artifact_name = getattr(config, 'model_artifact_name', MODEL_ARTIFACT_NAME)
|
|
165
|
+
detector_name = getattr(config, 'detector_name', DETECTOR_NAME)
|
|
166
|
+
blurrer_name = getattr(config, 'blurrer_name', BLURRER_NAME)
|
|
167
|
+
|
|
168
|
+
# Build model artifact path
|
|
169
|
+
model_artifact = os.path.join(model_artifactory_url, model_artifact_name)
|
|
170
|
+
|
|
171
|
+
# Initialize face blur with configuration
|
|
172
|
+
self.face_blur = FaceBlur(
|
|
173
|
+
model_artifact=model_artifact,
|
|
174
|
+
detector_name=detector_name,
|
|
175
|
+
blurrer_name=blurrer_name
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Note: isinstance check removed as it causes issues with mocking in tests
|
|
179
|
+
|
|
180
|
+
# Set additional configuration if available
|
|
181
|
+
if hasattr(config, 'blur_strength'):
|
|
182
|
+
self.blur_strength = config.blur_strength
|
|
183
|
+
else:
|
|
184
|
+
self.blur_strength = 1.0
|
|
185
|
+
|
|
186
|
+
if hasattr(config, 'detection_confidence_threshold'):
|
|
187
|
+
self.detection_confidence_threshold = config.detection_confidence_threshold
|
|
188
|
+
else:
|
|
189
|
+
self.detection_confidence_threshold = 0.25
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
if hasattr(config, 'debug'):
|
|
193
|
+
self.debug = config.debug
|
|
194
|
+
else:
|
|
195
|
+
self.debug = False
|
|
196
|
+
|
|
197
|
+
logger.info(f"FilterFaceblur setup completed. Detector: {detector_name}, Blurrer: {blurrer_name}, Debug: {self.debug}")
|
|
198
|
+
|
|
199
|
+
def shutdown(self):
|
|
200
|
+
pass # TODO: shutdown
|
|
201
|
+
|
|
202
|
+
def process(self, frames: Dict) -> Dict:
|
|
203
|
+
# Initialize output frames dictionary
|
|
204
|
+
output_frames = {}
|
|
205
|
+
|
|
206
|
+
# Process all frames that contain images
|
|
207
|
+
for topic, frame in frames.items():
|
|
208
|
+
if frame is None or not frame.has_image:
|
|
209
|
+
# Forward non-image frames as-is if upstream forwarding is enabled
|
|
210
|
+
if self.config.forward_upstream_data:
|
|
211
|
+
output_frames[topic] = frame
|
|
212
|
+
continue
|
|
213
|
+
|
|
214
|
+
# Detect faces and get coordinates
|
|
215
|
+
faces = self.face_blur.detector.detect_faces(frame.rw_bgr.image, self.config.detection_confidence_threshold)
|
|
216
|
+
|
|
217
|
+
if self.config.debug:
|
|
218
|
+
logger.info(f"Detected {len(faces)} faces in {topic} frame")
|
|
219
|
+
|
|
220
|
+
# Apply face blurring (only if enabled and strength > 0)
|
|
221
|
+
if self.config.blur_enabled and self.config.blur_strength > 0:
|
|
222
|
+
if self.config.debug:
|
|
223
|
+
logger.info(f"Applying blur with strength {self.config.blur_strength} to {topic} frame")
|
|
224
|
+
output = self.face_blur.process_frame(frame.rw_bgr.image, self.config.detection_confidence_threshold, self.config.blur_strength)
|
|
225
|
+
else:
|
|
226
|
+
# Skip blurring but still return the original frame
|
|
227
|
+
if self.config.debug:
|
|
228
|
+
blur_reason = "disabled" if not self.config.blur_enabled else f"strength={self.config.blur_strength}"
|
|
229
|
+
logger.info(f"Blurring skipped ({blur_reason}) for {topic} frame")
|
|
230
|
+
output = frame.rw_bgr.image
|
|
231
|
+
|
|
232
|
+
# Prepare frame data
|
|
233
|
+
frame_data = frame.data.copy() if frame.data else {}
|
|
234
|
+
|
|
235
|
+
# Include face detection information if enabled
|
|
236
|
+
if self.config.include_face_coordinates:
|
|
237
|
+
frame_data['faces_detected'] = len(faces)
|
|
238
|
+
frame_data['face_coordinates'] = faces
|
|
239
|
+
|
|
240
|
+
# Add individual face information if faces were detected
|
|
241
|
+
if faces:
|
|
242
|
+
frame_data['face_details'] = []
|
|
243
|
+
# Initialize meta dict for crop filter compatibility
|
|
244
|
+
if 'meta' not in frame_data:
|
|
245
|
+
frame_data['meta'] = {}
|
|
246
|
+
|
|
247
|
+
# Prepare detections in format expected by FilterCrop
|
|
248
|
+
detections = []
|
|
249
|
+
for i, face_data in enumerate(faces):
|
|
250
|
+
# Handle both old format (list) and new format (dict)
|
|
251
|
+
if isinstance(face_data, dict):
|
|
252
|
+
face_box = face_data['bbox']
|
|
253
|
+
confidence = face_data['confidence']
|
|
254
|
+
else:
|
|
255
|
+
# Backward compatibility for old format
|
|
256
|
+
face_box = face_data
|
|
257
|
+
confidence = None
|
|
258
|
+
|
|
259
|
+
x, y, w, h = face_box
|
|
260
|
+
|
|
261
|
+
# Convert to [x1, y1, x2, y2] format for crop filter
|
|
262
|
+
x1, y1, x2, y2 = int(x), int(y), int(x + w), int(y + h)
|
|
263
|
+
|
|
264
|
+
# Create detection object for crop filter
|
|
265
|
+
detection = {
|
|
266
|
+
'class': 'face', # detection_class_field
|
|
267
|
+
'rois': [x1, y1, x2, y2] # detection_roi_field
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
# Add confidence if available
|
|
271
|
+
if confidence is not None:
|
|
272
|
+
detection['confidence'] = confidence
|
|
273
|
+
|
|
274
|
+
detections.append(detection)
|
|
275
|
+
|
|
276
|
+
# Also create detailed face info for backward compatibility
|
|
277
|
+
face_info = {
|
|
278
|
+
'face_id': i,
|
|
279
|
+
'bounding_box': {
|
|
280
|
+
'x': int(x),
|
|
281
|
+
'y': int(y),
|
|
282
|
+
'width': int(w),
|
|
283
|
+
'height': int(h)
|
|
284
|
+
},
|
|
285
|
+
'center': {
|
|
286
|
+
'x': int(x + w/2),
|
|
287
|
+
'y': int(y + h/2)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
# Add confidence if available
|
|
292
|
+
if confidence is not None:
|
|
293
|
+
face_info['confidence'] = confidence
|
|
294
|
+
|
|
295
|
+
frame_data['face_details'].append(face_info)
|
|
296
|
+
|
|
297
|
+
# Store detections in meta for crop filter
|
|
298
|
+
frame_data['meta']['detections'] = detections
|
|
299
|
+
|
|
300
|
+
# Create processed frame
|
|
301
|
+
processed_frame = Frame(image=output, data=frame_data, format='BGR')
|
|
302
|
+
output_frames[topic] = processed_frame
|
|
303
|
+
|
|
304
|
+
# Ensure main topic comes first in the output dictionary
|
|
305
|
+
if 'main' in output_frames:
|
|
306
|
+
main_frame = output_frames.pop('main')
|
|
307
|
+
return {'main': main_frame, **output_frames}
|
|
308
|
+
|
|
309
|
+
return output_frames
|
|
310
|
+
|
|
311
|
+
def get_name(self):
|
|
312
|
+
return "FaceBlurFilter"
|
|
313
|
+
|
|
314
|
+
def get_description(self):
|
|
315
|
+
return "This filter blurs faces in the frame."
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
if __name__ == '__main__':
|
|
319
|
+
FilterFaceblur.run()
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: filter_faceblur
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
License-Expression: Apache-2.0
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Requires-Python: <3.14,>=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: python-dotenv==1.0.1
|
|
14
|
+
Requires-Dist: openfilter[all]<0.2.0,>=0.1.0
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: build==1.2.1; extra == "dev"
|
|
17
|
+
Requires-Dist: setuptools==72.2.0; extra == "dev"
|
|
18
|
+
Requires-Dist: twine<7,>=6.1.0; extra == "dev"
|
|
19
|
+
Requires-Dist: wheel==0.44.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest==8.3.4; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-cov==6.0.0; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# FaceGuard
|
|
25
|
+
|
|
26
|
+
FaceGuard is a computer vision filter that automatically detects and blurs faces in video streams using OpenCV's YuNet face detection model. Perfect for privacy-conscious applications that need real-time face anonymization.
|
|
27
|
+
|
|
28
|
+
## Demo
|
|
29
|
+
|
|
30
|
+
Here are some examples of FaceGuard in action:
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
The easiest way to run FaceGuard is using the provided usage script:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Basic usage with default settings
|
|
42
|
+
python scripts/filter_usage.py
|
|
43
|
+
|
|
44
|
+
# Custom video input
|
|
45
|
+
VIDEO_INPUT="./data/your-video.mp4" python scripts/filter_usage.py
|
|
46
|
+
|
|
47
|
+
# Custom configuration
|
|
48
|
+
FILTER_DETECTION_CONFIDENCE_THRESHOLD=0.3 FILTER_BLUR_STRENGTH=2.0 python scripts/filter_usage.py
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Environment Variables
|
|
52
|
+
|
|
53
|
+
The filter can be configured using environment variables:
|
|
54
|
+
|
|
55
|
+
| Variable | Default | Description |
|
|
56
|
+
|----------|---------|-------------|
|
|
57
|
+
| `VIDEO_INPUT` | `./data/video-01.mp4` | Input video file path |
|
|
58
|
+
| `OUTPUT_VIDEO_PATH` | `./output/{input_name}_blurred.mp4` | Output video file path |
|
|
59
|
+
| `OUTPUT_FPS` | `30` | Output video frames per second |
|
|
60
|
+
| `WEBVIS_PORT` | `8000` | Port for Webvis visualization |
|
|
61
|
+
| `FILTER_DETECTOR_NAME` | `yunet` | Face detector type |
|
|
62
|
+
| `FILTER_BLURRER_NAME` | `gaussian` | Blur algorithm type |
|
|
63
|
+
| `FILTER_BLUR_STRENGTH` | `1.0` | Blur intensity |
|
|
64
|
+
| `FILTER_DETECTION_CONFIDENCE_THRESHOLD` | `0.25` | Minimum confidence for face detection |
|
|
65
|
+
| `FILTER_DEBUG` | `False` | Enable debug logging |
|
|
66
|
+
| `FILTER_FORWARD_UPSTREAM_DATA` | `True` | Forward data from upstream filters |
|
|
67
|
+
| `FILTER_INCLUDE_FACE_COORDINATES` | `True` | Include face coordinates in frame data |
|
|
68
|
+
|
|
69
|
+
### Viewing Results
|
|
70
|
+
|
|
71
|
+
After running the filter, you can view the results at:
|
|
72
|
+
- **Webvis**: `http://localhost:8000` - Real-time video stream
|
|
73
|
+
- **Output Video**: Check the `./output/` directory for the processed video file
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
For detailed information about configuration options, performance tuning, and advanced usage, see the [comprehensive documentation](https://github.com/PlainsightAI/filter-faceblur/docs/overview.md).
|
|
78
|
+
|
|
79
|
+
## Features
|
|
80
|
+
|
|
81
|
+
- **Real-time Face Detection**: Uses OpenCV's YuNet model for accurate face detection
|
|
82
|
+
- **Configurable Blurring**: Adjustable blur strength and detection sensitivity
|
|
83
|
+
- **Rich Metadata**: Face coordinates, confidence scores, and detection details
|
|
84
|
+
- **Environment Variable Configuration**: No command-line arguments needed
|
|
85
|
+
- **Upstream Data Forwarding**: Passes through data from other filters
|
|
86
|
+
- **Debug Mode**: Optional logging for development and troubleshooting
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
To install the filter and its dependencies:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Create and activate virtual environment
|
|
94
|
+
virtualenv venv
|
|
95
|
+
source venv/bin/activate
|
|
96
|
+
|
|
97
|
+
# Install the filter
|
|
98
|
+
make install
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Run locally
|
|
102
|
+
|
|
103
|
+
To run the filter locally:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
make run
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then navigate to `http://localhost:8000` to see the video stream.
|
|
110
|
+
|
|
111
|
+
## Run in Docker
|
|
112
|
+
|
|
113
|
+
Build and run the filter in Docker:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Build the Docker image
|
|
117
|
+
make build-image
|
|
118
|
+
|
|
119
|
+
# Run the filter
|
|
120
|
+
make run-image
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Navigate to `http://localhost:8000` to view the video stream.
|
|
124
|
+
|
|
125
|
+
## Testing
|
|
126
|
+
|
|
127
|
+
Run the test suite:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
make test
|
|
131
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
filter_faceblur/__init__.py,sha256=iTtMAaq2KzWkKDCoDHIskJGh0TZ4AX6Y3tyuRsbgsdU,125
|
|
2
|
+
filter_faceblur/filter.py,sha256=ModuB9XMueguXwcF4dGpkg7lYSZ-mbCwtjsjNK-eG4c,14959
|
|
3
|
+
filter_faceblur-1.1.1.dist-info/licenses/LICENSE,sha256=Hun-T5YKdxKbQ1lfbGCu8YiknxeFsTnWAuSWz6CKQAQ,11343
|
|
4
|
+
filter_faceblur-1.1.1.dist-info/METADATA,sha256=k2xrgvhFvTH9hJhOzeH9MG9MA5_yR02qyfIWf6rjzdg,4215
|
|
5
|
+
filter_faceblur-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
filter_faceblur-1.1.1.dist-info/top_level.txt,sha256=uQ1onczDWQ66Ek73xTJk2kstH7ibKbMV2bRNJhEhPdY,16
|
|
7
|
+
filter_faceblur-1.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2025] [Plainsight]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
filter_faceblur
|