Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-115
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-115
2021-115
Commits
a5818969
Commit
a5818969
authored
Jul 03, 2021
by
Odhara Kodikara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare encoding function added
parent
75c922eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
Kidnapper_detection/face-detection.py
Kidnapper_detection/face-detection.py
+20
-0
No files found.
Kidnapper_detection/face-detection.py
View file @
a5818969
...
...
@@ -85,12 +85,32 @@ def facial_recognition():
cv2
.
imshow
(
"Frame"
,
image
)
cv2
.
waitKey
(
0
)
def
prepare_enc
():
imagePaths
=
list
(
paths
.
list_images
(
'Images'
))
knownEncodings
=
[]
knownNames
=
[]
for
(
i
,
imagePath
)
in
enumerate
(
imagePaths
):
name
=
imagePath
.
split
(
os
.
path
.
sep
)[
-
2
]
image
=
cv2
.
imread
(
imagePath
)
rgb
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_BGR2RGB
)
boxes
=
face_recognition
.
face_locations
(
rgb
,
model
=
'hog'
)
encodings
=
face_recognition
.
face_encodings
(
rgb
,
boxes
)
for
encoding
in
encodings
:
knownEncodings
.
append
(
encoding
)
knownNames
.
append
(
name
)
data
=
{
"encodings"
:
knownEncodings
,
"names"
:
knownNames
}
f
=
open
(
"face_enc"
,
"wb"
)
f
.
write
(
pickle
.
dumps
(
data
))
f
.
close
()
def
main
(
argv
):
if
(
len
(
sys
.
argv
)
>
0
):
# Check if Arguments Exist
for
i
,
arg
in
enumerate
(
sys
.
argv
):
if
arg
==
"new"
:
print
(
"New Face Recogniser"
)
prepare_enc
()
found
=
face_detection
()
print
(
found
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment