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
bdcb791b
Commit
bdcb791b
authored
2 years ago
by
Dorababu A
Browse files
Options
Downloads
Patches
Plain Diff
clean the code
parent
316e3b3d
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/py_fp_image.py
+22
-55
22 additions, 55 deletions
ReadRawData/pyScripts/py_fp_image.py
with
22 additions
and
55 deletions
ReadRawData/pyScripts/py_fp_image.py
+
22
−
55
View file @
bdcb791b
"""
Analysis of FP data
"""
import
numpy
as
np
import
serial
import
time
import
matplotlib.pyplot
as
plt
import
fingerprint_enhancer
import
cv2
from
PIL
import
Image
,
ImageOps
# replace space to new line
def
create_np_array
(
file_name
):
'''
Read data from text file and save in an array
'''
temps
=
[]
with
open
(
file_name
,
"
r
"
)
as
r
:
with
open
(
"
fpData/temp.txt
"
,
"
w
"
)
as
w
:
...
...
@@ -26,39 +29,20 @@ def create_np_array(file_name):
print
(
"
Space
"
)
f
.
close
()
'''
ser = serial.Serial(
'
com12
'
, 115200, timeout = 0.1)
time.sleep(0.2)
for i in range(25600):
line = ser.readline()
if line:
string = line.decode()
num = int(string)
print(num, end =
'
'
)
temps.append(int(string))
ser.close()
'''
# print(temps)
# Store list into numpy array
# store list in to numpy array
fp_array
=
np
.
array
(
temps
)
# print(fp_array)
print
(
type
(
fp_array
))
print
(
len
(
fp_array
))
return
(
fp_array
)
# Display array
def
display_fp
(
fp_arr
):
'''
shape array to show as pixels
'''
# Construct image from data
# width and height
# 25600 = 160*160
w
,
h
=
160
,
160
t
=
(
h
,
w
,
3
)
...
...
@@ -68,34 +52,17 @@ def display_fp(fp_arr):
a
=
int
(
index
%
160
)
b
=
int
(
index
/
160
)
fp_sample
[
a
,
b
]
=
[
a
,
b
,
(
int
(
value
)
*
255
)]
# fp_sample[a,b] = [40+a, 80+b, int(value)]
# fp_sample[a,b] = [10+a, 20+b, int(value)]
i
=
Image
.
fromarray
(
fp_sample
)
i
.
show
()
# i = Image.fromarray(fp_sample)
# i.show()
plt
.
gray
()
plt
.
imshow
(
fp_sample
)
plt
.
show
()
'''
i.save(
"
Img/temp.png
"
)
og_image = Image.open(
"
Img/temp.png
"
)
gray_image= ImageOps.grayscale(og_image)
gray_image.save(
"
Img/temp.png
"
)
gray_image.show(
"
img/temp.png
"
)
'''
'''
img = cv2.imread(
"
Img/temp.png
"
, 0)
out = fingerprint_enhancer.enhance_Fingerprint(img)
cv2.imshow(
'
enhanced_image
'
, out); # display the result
cv2.waitKey(0)
'''
# Plot on xy axis
'''
x = np.arange(0,25600)
y = fp_array[x]
plt.plot(x, y, color =
'
red
'
)
plt.show()
'''
# main function
if
__name__
==
'
__main__
'
:
fp_array1
=
create_np_array
(
"
fpData/RawData1.txt
"
)
...
...
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