commit
ab0d1ab7b9
4 changed files with 44 additions and 7 deletions
14
.gitignore
vendored
14
.gitignore
vendored
|
|
@ -111,3 +111,17 @@ debian/howdy.substvars
|
||||||
debian/files
|
debian/files
|
||||||
debian/debhelper-build-stamp
|
debian/debhelper-build-stamp
|
||||||
debian/howdy
|
debian/howdy
|
||||||
|
|
||||||
|
# vscode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
@ -96,7 +96,7 @@ def send_to_ui(type, message):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Make sure we were given an username to tast against
|
# Make sure we were given an username to test against
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
exit(12)
|
exit(12)
|
||||||
|
|
||||||
|
|
@ -150,6 +150,7 @@ end_report = config.getboolean("debug", "end_report", fallback=False)
|
||||||
capture_failed = config.getboolean("snapshots", "capture_failed", fallback=False)
|
capture_failed = config.getboolean("snapshots", "capture_failed", fallback=False)
|
||||||
capture_successful = config.getboolean("snapshots", "capture_successful", fallback=False)
|
capture_successful = config.getboolean("snapshots", "capture_successful", fallback=False)
|
||||||
gtk_stdout = config.getboolean("debug", "gtk_stdout", fallback=False)
|
gtk_stdout = config.getboolean("debug", "gtk_stdout", fallback=False)
|
||||||
|
rotate = config.getint("video", "rotate", fallback=0)
|
||||||
|
|
||||||
# Send the gtk outupt to the terminal if enabled in the config
|
# Send the gtk outupt to the terminal if enabled in the config
|
||||||
gtk_pipe = sys.stdout if gtk_stdout else subprocess.DEVNULL
|
gtk_pipe = sys.stdout if gtk_stdout else subprocess.DEVNULL
|
||||||
|
|
@ -193,9 +194,11 @@ del lock
|
||||||
|
|
||||||
# Fetch the max frame height
|
# Fetch the max frame height
|
||||||
max_height = config.getfloat("video", "max_height", fallback=0.0)
|
max_height = config.getfloat("video", "max_height", fallback=0.0)
|
||||||
# Get the height of the image
|
|
||||||
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1
|
|
||||||
|
|
||||||
|
# Get the height of the image (which would be the width if screen is portrait oriented)
|
||||||
|
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_HEIGHT) or 1
|
||||||
|
if rotate == 2:
|
||||||
|
height = video_capture.internal.get(cv2.CAP_PROP_FRAME_WIDTH) or 1
|
||||||
# Calculate the amount the image has to shrink
|
# Calculate the amount the image has to shrink
|
||||||
scaling_factor = (max_height / height) or 1
|
scaling_factor = (max_height / height) or 1
|
||||||
|
|
||||||
|
|
@ -272,16 +275,30 @@ while True:
|
||||||
dark_tries += 1
|
dark_tries += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If the hight is too high
|
# If the height is too high
|
||||||
if scaling_factor != 1:
|
if scaling_factor != 1:
|
||||||
# Apply that factor to the frame
|
# Apply that factor to the frame
|
||||||
frame = cv2.resize(frame, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
|
frame = cv2.resize(frame, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
|
||||||
gsframe = cv2.resize(gsframe, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
|
gsframe = cv2.resize(gsframe, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
|
||||||
|
# If camera is configured to rotate = 1, check portrait in addition to landscape
|
||||||
|
if rotate == 1:
|
||||||
|
if frames % 3 == 1:
|
||||||
|
frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||||
|
gsframe = cv2.rotate(gsframe, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||||
|
if frames % 3 == 2:
|
||||||
|
frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE)
|
||||||
|
gsframe = cv2.rotate(gsframe, cv2.ROTATE_90_CLOCKWISE)
|
||||||
|
# If camera is configured to rotate = 2, check portrait orientation
|
||||||
|
elif rotate == 2:
|
||||||
|
if frames % 2 == 0:
|
||||||
|
frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||||
|
gsframe = cv2.rotate(gsframe, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||||
|
else:
|
||||||
|
frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE)
|
||||||
|
gsframe = cv2.rotate(gsframe, cv2.ROTATE_90_CLOCKWISE)
|
||||||
# Get all faces from that frame as encodings
|
# Get all faces from that frame as encodings
|
||||||
# Upsamples 1 time
|
# Upsamples 1 time
|
||||||
face_locations = face_detector(gsframe, 1)
|
face_locations = face_detector(gsframe, 1)
|
||||||
|
|
||||||
# Loop through each face
|
# Loop through each face
|
||||||
for fl in face_locations:
|
for fl in face_locations:
|
||||||
if use_cnn:
|
if use_cnn:
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,12 @@ force_mjpeg = false
|
||||||
# OPENCV only.
|
# OPENCV only.
|
||||||
exposure = -1
|
exposure = -1
|
||||||
|
|
||||||
|
# Rotate captured frames so faces are upright.
|
||||||
|
# Check landscape orientation only: rotate = 0
|
||||||
|
# Check landscape and portrait orientation: rotate = 1
|
||||||
|
# Check portrait orientation only: rotate = 2
|
||||||
|
rotate = 0
|
||||||
|
|
||||||
[snapshots]
|
[snapshots]
|
||||||
# Capture snapshots of failed login attempts and save them to disk with metadata
|
# Capture snapshots of failed login attempts and save them to disk with metadata
|
||||||
# Snapshots are saved to the "snapshots" folder
|
# Snapshots are saved to the "snapshots" folder
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ config.read(os.path.dirname(os.path.abspath(__file__)) + "/config.ini")
|
||||||
def doAuth(pamh):
|
def doAuth(pamh):
|
||||||
"""Starts authentication in a seperate process"""
|
"""Starts authentication in a seperate process"""
|
||||||
|
|
||||||
# Abort is Howdy is disabled
|
# Abort if Howdy is disabled
|
||||||
if config.getboolean("core", "disabled"):
|
if config.getboolean("core", "disabled"):
|
||||||
return pamh.PAM_AUTHINFO_UNAVAIL
|
return pamh.PAM_AUTHINFO_UNAVAIL
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue