Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pageauc committed Sep 26, 2023
1 parent 43ee7cd commit 4b72fa8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions speed-cam.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3
from __future__ import print_function
PROG_VER = "13.05" # current version of this python script
PROG_VER = "13.06" # current version of this python script
'''
speed-cam.py written by Claude Pageau
Windows, Unix, Raspberry (Pi) - python opencv2 Speed tracking
Expand Down Expand Up @@ -324,7 +324,7 @@
from plugins.current import *
except Exception as err_msg:
logging.warning("%s" % err_msg)

CAMERA_WIDTH, CAMERA_HEIGHT = IM_SIZE

# import the necessary packages
Expand Down Expand Up @@ -1842,16 +1842,16 @@ def speed_camera():

vs = strmcam() # start video stream thread
# Get actual image size from stream.
# Necessary for IP camera
image1 = vs.read()
# Necessary for IP camera
image1 = vs.read()
try:
grayimage1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
except cv2.error as err_msg:
logging.error('%s Problem Connecting Camera. Review Log Messages and Correct', CAMERA.upper())
logging.error(err_msg)
logging.error('Check camera connection settings and Hardware')
sys.exit(1)
img_height, img_width, _ = image1.shape
img_height, img_width, _ = image1.shape
image_width = int(img_width * IM_BIGGER)
# Set height of trigger point image to save
image_height = int(img_height * IM_BIGGER)
Expand All @@ -1873,12 +1873,11 @@ def speed_camera():
# setup buffer area to ensure contour is mostly contained in crop area
x_buf = int((MO_CROP_X_RIGHT - MO_CROP_X_LEFT) / MO_X_LR_SIDE_BUFF_PX)
make_media_dirs()
try:
try:
speed_camera() # run main speed camera processing loop
except KeyboardInterrupt:
print("")
logging.info("User Pressed Keyboard ctrl-c")
logging.info("%s %s Exiting Program", PROG_NAME, PROG_VER)
# Remove temporary plugin configuration file if it exists. plugins/current.py
if PLUGIN_ENABLE_ON:
logging.info("Remove Temporary plugin config Files")
Expand All @@ -1894,5 +1893,6 @@ def speed_camera():
logging.warning("Failed To Remove File %s - %s", pluginCurrentpyc, err_msg)
logging.info("%s Stop Camera Stream Thread.", CAMERA.upper())
vs.stop()
logging.info("%s %s Exiting Program", PROG_NAME, PROG_VER)
logging.info("Bye ...")
sys.exit()
2 changes: 1 addition & 1 deletion sql_speed_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def make_html_report_list():
os.path.abspath(os.path.dirname(image_path)),
os.path.abspath(REPORTS_DIR)),
image_filename)
table_row = ('<tr><td>%s</td><td>%s %s</td><td>%s</td><td><a href="%s">%s</a></td></tr>' %
table_row = ('<tr><td>%s</td><td>%s %s</td><td>%s</td><td><a href="../%s">%s</a></td></tr>' %
(log_date,
ave_speed,
speed_units,
Expand Down
2 changes: 1 addition & 1 deletion strmcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def is_pi_legacy_cam():
return True
else:
logging.warn("Problem Finding Pi Legacy Camera %s", camResult)
logging.warn('Check Camera Connections and Legacy Pi Cam is Enabled per command sudo raspi=config')
logging.warn('Check Camera Connections and Legacy Pi Cam is Enabled per command sudo raspi-config')
return False


Expand Down

0 comments on commit 4b72fa8

Please sign in to comment.