Skip to content

Commit

Permalink
Improved dashcam overlay stamp efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
connervieira committed May 23, 2024
1 parent 5d17f60 commit c97e5f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ These are the features actively planned for Predator and are likely to be added
- [X] Add dash-cam operation mode stamp.
- [X] Add custom relay status stamps through GPIO.
- [X] Add default config support for values that involve adding entries.
- [ ] Improve the efficiency of the GPS stamp.

## Hypothetical

Expand Down
17 changes: 9 additions & 8 deletions dashcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,15 @@ def apply_dashcam_stamps(frame, device=""):
gps_stamp_position = [10, 30] # Determine where the GPS overlay stamp should be positioned in the video stream.
gps_stamp = "" # Set the GPS to a blank placeholder. Elements will be added to this in the next steps.
if (config["general"]["gps"]["enabled"] == True): # Check to see if GPS features are enabled before processing the GPS stamp.
current_location = get_gps_location() # Get the current location.

if (config["dashcam"]["stamps"]["gps"]["location"]["enabled"] == True): # Check to see if the GPS location stamp is enabled.
gps_stamp = gps_stamp + "(" + str(f'{current_location[0]:.5f}') + ", " + str(f'{current_location[1]:.5f}') + ") " # Add the current coordinates to the GPS stamp.
if (config["dashcam"]["stamps"]["gps"]["altitude"]["enabled"] == True): # Check to see if the GPS altitude stamp is enabled.
gps_stamp = gps_stamp + str(round(current_location[3])) + "m " # Add the current altitude to the GPS stamp.
if (config["dashcam"]["stamps"]["gps"]["speed"]["enabled"] == True): # Check to see if the GPS speed stamp is enabled.
gps_stamp = gps_stamp + str(round(convert_speed(current_location[2],config["dashcam"]["stamps"]["gps"]["speed"]["unit"])*10)/10) + config["dashcam"]["stamps"]["gps"]["speed"]["unit"] + " " # Add the current speed to the GPS stamp.
if (config["dashcam"]["stamps"]["gps"]["location"]["enabled"] == True or config["dashcam"]["stamps"]["gps"]["altitude"]["enabled"] == True or config["dashcam"]["stamps"]["gps"]["speed"]["enabled"] == True): # Check to see if at least one of the GPS stamps is enabled.
current_location = get_gps_location() # Get the current location.

if (config["dashcam"]["stamps"]["gps"]["location"]["enabled"] == True): # Check to see if the GPS location stamp is enabled.
gps_stamp = gps_stamp + "(" + str(f'{current_location[0]:.5f}') + ", " + str(f'{current_location[1]:.5f}') + ") " # Add the current coordinates to the GPS stamp.
if (config["dashcam"]["stamps"]["gps"]["altitude"]["enabled"] == True): # Check to see if the GPS altitude stamp is enabled.
gps_stamp = gps_stamp + str(round(current_location[3])) + "m " # Add the current altitude to the GPS stamp.
if (config["dashcam"]["stamps"]["gps"]["speed"]["enabled"] == True): # Check to see if the GPS speed stamp is enabled.
gps_stamp = gps_stamp + str(round(convert_speed(current_location[2],config["dashcam"]["stamps"]["gps"]["speed"]["unit"])*10)/10) + config["dashcam"]["stamps"]["gps"]["speed"]["unit"] + " " # Add the current speed to the GPS stamp.

# Determine the font color of the stamps from the configuration.
main_stamp_color = config["dashcam"]["stamps"]["main"]["color"]
Expand Down

0 comments on commit c97e5f0

Please sign in to comment.