Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
assignment Programming 2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Gastel, L. van (Lex, Student B-BMT)
assignment Programming 2
Commits
b3446797
Commit
b3446797
authored
6 days ago
by
LexvanGastel
Browse files
Options
Downloads
Patches
Plain Diff
vraag 18
parent
7e98fb2d
Branches
feature/image_processor
feature/plotter
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Q2main.py
+26
-0
26 additions, 0 deletions
Q2main.py
main.py
+20
-1
20 additions, 1 deletion
main.py
with
46 additions
and
1 deletion
Q2main.py
+
26
−
0
View file @
b3446797
class
ImageProcessor
:
def
__init__
(
self
,
image_path
):
self
.
image
self
.
image_rgb
self
.
image_hsv
def
apply_median_filter
(
self
,
kernel_size
):
return
filterd_image
def
get_color_channels
(
self
):
return
red_channel
,
green_channel
,
blue_channel
def
convert_to_hsv
(
self
):
return
hsv_image
class
Plotter
:
def
__init__
(
self
):
pass
def
plot_image_channels
(
self
,
image
):
return
None
def
plot_histograms
(
self
,
image
):
return
None
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.py
+
20
−
1
View file @
b3446797
import
scipy.io
import
numpy
as
np
from
scipy.signal
import
butter
,
filtfilt
from
scipy.signal
import
butter
,
filtfilt
,
find_peaks
import
matplotlib.pyplot
as
plt
def
load_emg_data
(
file_path
):
...
...
@@ -130,6 +130,25 @@ def plot_emg_data(file_path):
freq_rf
,
fft_rf
=
compute_fft
(
envelope_rf
,
sampling_rate
)
freq_ta
,
fft_ta
=
compute_fft
(
envelope_ta
,
sampling_rate
)
peaks_rf
,
_
=
find_peaks
(
envelope_rf
)
peaks_ta
,
_
=
find_peaks
(
envelope_ta
)
num_peaks_rf
=
len
(
peaks_rf
)
num_peaks_ta
=
len
(
peaks_ta
)
max_value_rf
=
np
.
max
(
envelope_rf
)
max_value_ta
=
np
.
max
(
envelope_ta
)
area_rf
=
np
.
trapz
(
envelope_rf
,
time_vector
)
area_ta
=
np
.
trapz
(
envelope_ta
,
time_vector
)
print
(
f
"
1.Numbers of EMG peaks Rectus Femoris:
{
num_peaks_rf
}
"
)
print
(
f
"
1.Numbers of EMG peaks Tibialis Anterior:
{
num_peaks_ta
}
"
)
print
(
f
"
2. Maximale peak Rectus Femoris:
{
max_value_rf
}
"
)
print
(
f
"
2. Maximale peak Tibialis Anterior:
{
max_value_ta
}
"
)
print
(
f
"
3. Area under Curve Rectus Femoris
{
area_rf
}
"
)
print
(
f
"
3. Area under Curve Tibialis Anterior
{
area_ta
}
"
)
plt
.
figure
(
figsize
=
(
13
,
8
))
plt
.
subplot
(
2
,
2
,
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