Skip to content

Commit

Permalink
Added status light support to dashcam ALPR
Browse files Browse the repository at this point in the history
  • Loading branch information
connervieira committed Sep 5, 2024
1 parent 18fdd4a commit 6913fae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ March 6th, 2024

## Version 11.0

### Unification Update
### Refinement Update

This update focuses on unifying Predator's different modes to allow multipurpose functionality. Additional, this update emphasizes improving the reliability of Predator, especially when operating in dash-cam mode.
This update emphasizes improving the reliability of Predator, especially when operating in dash-cam mode. This update also expands the functionality of dash-cam mode to allow simultaneous dash-cam recording and ALPR analysis.

*Release date to be determined*

Expand All @@ -448,7 +448,6 @@ This update focuses on unifying Predator's different modes to allow multipurpose
- Predator will no longer try to apply a time offset when the system time is in the future relative to the GPS time.
- Predator no longer displays warning about the time being desynced when GPS time correction is disabled.
- Predator will now reset the time offset if the system time changes.
- Increased the max-depth of the configuration validation process.
- Updated dash-cam mode.
- Added customizable frame-rate restrictions.
- Added a per-device configuration value to set a maximum allowed frame-rate. When this frame-rate is exceeded, Predator will throttle dash-cam recording to stay below the limit.
Expand Down Expand Up @@ -488,11 +487,14 @@ This update focuses on unifying Predator's different modes to allow multipurpose
- Moved the status lighting configuration to the "general" section.
- Network requests are only made to update the status lighting if it has changed since the last update.
- This means that the status lighting can be turned off, and it will only turn back on when an update is made.
- Changed the default `dashcam_save` status light color to blue, to avoid confusion with `alpr_alert`.
- Updated configuration back-end.
- Increased the max-depth of the configuration validation process.
- Predator can now automatically update the configuration file between versions when configuration values are added or removed.
- Added an initial start-up sequence, where Predator shows some basic information before the normal start-up.
- Predator now creates a file named `install.json` containing some basic install information on the first start-up.
- Remote alert database sources can now be cached.
- This allows Predator to continue using entries from a remote alert database even when the source goes offline.
- Migrated most of the ALPR processing to a dedicated file for sake of organization.
- Updated the ALPR handler.
- Remote alert database sources can now be cached.
- This allows Predator to continue using entries from a remote alert database even when the source goes offline.
- Migrated most of the ALPR processing to a dedicated file for sake of organization.
- The "detected plate" notification sound now plays regardless of the console output level.
2 changes: 1 addition & 1 deletion assets/support/configdefault.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"normal": "[U]&R=0&G=255&B=0",
"alpr_alert": "[U]&R=255&G=0&B=0",
"alpr_detection": "[U]&R=255&G=128&B=0",
"dashcam_save": "[U]&R=255&G=0&B=0"
"dashcam_save": "[U]&R=0&G=0&B=255"
}
}
},
Expand Down
17 changes: 14 additions & 3 deletions dashcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ def capture_dashcam_video(directory, device="main", width=1280, height=720):
plate_log = alpr.load_alpr_log()
def background_alpr(device):
global current_frame_data
global saving_active # This variable is used to determine which value the status lighting should be returned to after a plate detection.
if (config["realtime"]["saving"]["license_plates"]["enabled"] == True): # Check to see if the license plate logging file name is not empty. If the file name is empty, then license plate logging will be disabled.
global plate_log

Expand Down Expand Up @@ -922,8 +923,18 @@ def background_alpr(device):

# Display alerts.
alpr.display_alerts(active_alerts) # Display active alerts.
for plate in detected_plates_valid:
utils.play_sound("notification")
if (config["general"]["status_lighting"]["enabled"] == True): # Check to see if status lighting alerts are enabled in the Predator configuration.
if (len(active_alerts) > 0): # Check to see if there are active alerts.
update_status_lighting("alpr_alert") # Run the function to update the status lighting.
elif (len(detected_plates_valid) > 0):
update_status_lighting("alpr_detection") # Run the function to update the status lighting.
else:
if (saving_active == True):
update_status_lighting("dashcam_save") # Since the current dashcam segment is being saved, return to the corresponding status lighting value.
else:
update_status_lighting("normal")
for plate in detected_plates_valid: # Run once for each detected plate.
utils.play_sound("notification") # Play the "new plate detected" sound.
for alert in active_alerts: # Run once for each active alert.
if (config["realtime"]["push_notifications"]["enabled"] == True): # Check to see if the user has Gotify notifications enabled.
debug_message("Issuing alert push notification")
Expand Down Expand Up @@ -1146,7 +1157,7 @@ def dashcam_output_handler(directory, device, width, height, framerate):
dashcam_segment_saving.start() # Start the dashcam segment saving thread.
save_this_segment = False # Reset the segment saving flag.
saving_active = False
update_status_lighting("normal") # Return status lighting to normal.
update_status_lighting("normal") # Return status lighting to normal since a new segment has been started.


delete_old_segments() # Handle the erasing of any old dash-cam segments that need to be deleted.
Expand Down

0 comments on commit 6913fae

Please sign in to comment.