Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FPSfirmware
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dorababu A
FPSfirmware
Commits
694ae353
Commit
694ae353
authored
2 years ago
by
Dorababu A
Browse files
Options
Downloads
Patches
Plain Diff
Enhance fp image
parent
8922ac63
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ReadRawData/pyScripts/showFP.py
+51
-22
51 additions, 22 deletions
ReadRawData/pyScripts/showFP.py
with
51 additions
and
22 deletions
ReadRawData/pyScripts/showFP.py
+
51
−
22
View file @
694ae353
import
numpy
as
np
import
serial
import
time
from
PIL
import
Image
import
matplotlib.pyplot
as
plt
import
fingerprint_enhancer
from
skimage.morphology
import
skeletonize
# remove dot function for thinning fp image
def
removedot
(
invertThin
):
temp0
=
np
.
array
(
invertThin
[:])
temp0
=
np
.
array
(
temp0
)
temp1
=
temp0
/
255
temp2
=
np
.
array
(
temp1
)
temp3
=
np
.
array
(
temp2
)
enhanced_img
=
np
.
array
(
temp0
)
filter0
=
np
.
zeros
((
10
,
10
))
W
,
H
=
temp0
.
shape
[:
2
]
filtersize
=
6
for
i
in
range
(
W
-
filtersize
):
for
j
in
range
(
H
-
filtersize
):
filter0
=
temp1
[
i
:
i
+
filtersize
,
j
:
j
+
filtersize
]
flag
=
0
if
sum
(
filter0
[:,
0
])
==
0
:
flag
+=
1
if
sum
(
filter0
[:,
filtersize
-
1
])
==
0
:
flag
+=
1
if
sum
(
filter0
[
0
,:])
==
0
:
flag
+=
1
if
sum
(
filter0
[
filtersize
-
1
,:])
==
0
:
flag
+=
1
if
flag
>
3
:
temp2
[
i
:
i
+
filtersize
,
j
:
j
+
filtersize
]
=
np
.
zeros
((
filtersize
,
filtersize
))
return
temp2
# create a temp list to store values
...
...
@@ -28,7 +61,7 @@ while samples<4:
# num = int(string)
# print(num, end = ' ')
temps
[
samples
].
append
(
int
(
string
))
temps
[
samples
].
append
(
0
)
ser
.
close
()
# print(temps)
...
...
@@ -36,25 +69,21 @@ while samples<4:
# Store list into numpy array
fp_array
=
np
.
array
(
temps
[
samples
])
# print(fp_array)
print
(
type
(
fp_array
))
print
(
len
(
fp_array
))
# Construct image from data
w
,
h
=
240
,
240
t
=
(
h
,
w
,
3
)
fp_sample
=
np
.
zeros
(
t
,
dtype
=
np
.
uint8
)
for
index
,
value
in
enumerate
(
fp_array
):
a
=
int
(
index
%
160
)
b
=
int
(
index
/
160
)
fp_sample
[
a
,
b
]
=
[
40
+
a
,
80
+
b
,
int
(
value
)]
# construct image from data
fp_image
=
np
.
reshape
(
fp_array
,
(
160
,
160
))
# enhance fp image
fp_enhance_image
=
fingerprint_enhancer
.
enhance_Fingerprint
(
fp_image
)
# thinning enhaced image
fp_enhance_image
[
fp_enhance_image
==
255
]
=
1
skeleton
=
skeletonize
(
fp_enhance_image
)
skeleton
=
np
.
array
(
skeleton
,
dtype
=
np
.
uint8
)
skeleton
=
removedot
(
skeleton
)
i
=
Image
.
fromarray
(
fp_sample
)
i
.
show
()
plt
.
imshow
(
skeleton
,
'
gray
'
)
plt
.
show
()
samples
+=
1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment