-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
configHaving to do with the configuration of swatchHaving to do with the configuration of swatchsupportRequesting support for swatchRequesting support for swatch
Description
Describe the problem you are having
I copied the example config and simply changed the camera name to reflect an existing HASS one, and adding it's valid snapshot URL.
Version
3.1.0-2717ec6
Swatch config file
# REQUIRED: Define a list of objects that are expected to be seen. These can be specific
# to one camera or common between many / all cameras
objects:
# REQUIRED: Name of the object
cancello1:
# REQUIRED: the list of color variants that this object can be detected as. Useful for
# different lighting conditions
color_variants:
# REQUIRED: the name of the color variant
default:
# REQUIRED: the lower R, G, B values that are considered a potential match for the
# color variant of the object.
color_lower: 70, 70, 0
# REQUIRED: the upper R, G, B values that are considered a potential match for the
# color variant of the object.
color_upper: 110, 100, 50
# OPTIONAL: the time range for when this color variant is allowed
# NOTE: make sure that /etc/localtime is passed to the container so it has valid time
time_range:
# OPTIONAL: Color variant is valid if current time is > this 24H time (Default: shown below).
after: "00:00"
# OPTIONAL: Color variant is valid if current time is < this 24H time (Default: shown below).
before: "24:00"
# OPTIONAL: the min area of the bounding box around groups of matching R, G, B pixels
# considered a true positive. This is not recommended to be set as a super small amount
# could be a false positive. (Default: shown below)
min_area: 1000
# OPTIONAL: the max area of the bounding box around groups of pixels with R, G, B
# values within the bounds to be considered a true positive (Default: shown below).
max_area: 100000
# OPTIONAL: the min ratio of width/height of bounding box for valid object detection (default: shown below).
min_ratio: 0
# OPTIONAL: the max ratio of width/height of bounding box for valid object detection (default: shown below).
max_ratio: 24000000
# REQUIRED: Define list of cameras that will be used for color detection.
cameras:
# REQUIRED: Name of the camera
piazzale:
# OPTIONAL: Frequency in seconds to run detection on the camera.
# a value of 0 disables auto detection (Default: shown below).
auto_detect: 0
# OPTIONAL: Configure the url and retention of snapshots. (Default: Shown Below)
snapshot_config:
# OPTIONAL: but highly recommended, setting the default url for a snapshot to be
# processed by this camera. This is required for auto detection (Default: none).
url: "http://user:[email protected]/axis-cgi/jpg/image.cgi"
# OPTIONAL: Whether or not to draw bounding boxes for confirmed objects in the snapshots (Default: shown below).
bounding_box: true
# OPTIONAL: Whether or not to save a clean png of the snapshot along with the annotated jpg (Default: shown below).
clean_snapshot: true
# OPTIONAL: Whether or not to save the snapshots of confirmed detections (Default: shown below).
save_detections: true
# OPTIONAL: Whether or not to save the snapshots of missed detections (Default: shown below).
save_misses: false
# OPTIONAL: Variations of snapshots to keep. Options are all, mask, crop (Default: shown below).
mode: "all"
# OPTIONAL: Number of days of snapshots to keep (Default: shown below).
retain_days: 7
# REQUIRED: Zones are cropped areas where the object can be expected to be.
# This makes searching / matches for efficient and more predictable than searching
# the entire image.
zones:
# REQUIRED: Name of the zone.
street:
# REQUIRED: Coordinates to crop the zone by.
# NOTE: The order of the coordinates are: x, y, x+w, y+h starting in the top left corner as 0, 0.
coordinates: 225, 540, 350, 620
# REQUIRED: List of objects that may be in this zone. These correspond to
# the objects list defined previously and are matched by name.
objects:
- cancello1Relevant log output
[2024-02-09 17:05:28,217]: INFO - Starting SwatchApp
[2024-02-09 17:05:28,226]: INFO - Importing SwatchApp Config
[2024-02-09 17:05:28,226]: INFO - Verified SwatchApp Config
Starting migrations
[2024-02-09 17:05:28,243]: INFO - Starting migrations
There is nothing to migrate
[2024-02-09 17:05:28,252]: INFO - There is nothing to migrate
[2024-02-09 17:05:28,254]: INFO - Starting snapshot cleanup
[2024-02-09 17:05:28,254]: INFO - Starting Detection Cleanup
[2024-02-09 17:06:05,185]: ERROR - Exception on /piazzale/street/snapshot.jpg [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1519, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1517, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1503, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/opt/swatch/swatch/http.py", line 385, in get_latest_zone_snapshot
jpg_bytes = current_app.snapshot_processor.get_latest_zone_snapshot(
File "/opt/swatch/swatch/snapshot.py", line 206, in get_latest_zone_snapshot
crop = img[
TypeError: 'NoneType' object is not subscriptable
[2024-02-09 17:06:05,193]: ERROR - Exception on /piazzale/snapshot.jpg [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1519, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1517, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1503, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/opt/swatch/swatch/http.py", line 342, in get_latest_camera_snapshot
jpg_bytes = current_app.snapshot_processor.get_latest_camera_snapshot(camera_name)
File "/opt/swatch/swatch/snapshot.py", line 185, in get_latest_camera_snapshot
_, jpg = cv2.imencode(".jpg", img, [int(cv2.IMWRITE_JPEG_QUALITY), 70])
cv2.error: OpenCV(4.6.0) /io/opencv/modules/imgcodecs/src/loadsave.cpp:976: error: (-215:Assertion failed) !image.empty() in function 'imencode'Any other information that may be helpful
No response
Metadata
Metadata
Assignees
Labels
configHaving to do with the configuration of swatchHaving to do with the configuration of swatchsupportRequesting support for swatchRequesting support for swatch