Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Bildverarbeitung
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moh Kh
Bildverarbeitung
Commits
bb3a348c
Commit
bb3a348c
authored
1 year ago
by
Joel Steffens
Browse files
Options
Downloads
Patches
Plain Diff
Kleinere Verbesserungen
parent
c0d8c3fe
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
detect_waterstream.py
+18
-6
18 additions, 6 deletions
detect_waterstream.py
filters.py
+16
-5
16 additions, 5 deletions
filters.py
with
34 additions
and
11 deletions
detect_waterstream.py
+
18
−
6
View file @
bb3a348c
...
...
@@ -5,7 +5,7 @@
# Erkennung eines Wasserstrahls
#
# Autoren: - Joel Steffens
# - Mohamm
en
d K
a
# - Mohamm
a
d K
haleeliyeh
# - Midras Lappe
##############################################
import
cv2
...
...
@@ -24,7 +24,18 @@ if argc == 3:
skipSeconds
=
int
(
sys
.
argv
[
2
])
capture
=
cv2
.
VideoCapture
(
videoFile
)
capture
.
set
(
cv2
.
CAP_PROP_POS_FRAMES
,
30
*
skipSeconds
)
width
=
int
(
capture
.
get
(
cv2
.
CAP_PROP_FRAME_WIDTH
))
height
=
int
(
capture
.
get
(
cv2
.
CAP_PROP_FRAME_HEIGHT
))
fps
=
int
(
capture
.
get
(
cv2
.
CAP_PROP_FPS
))
frames
=
int
(
capture
.
get
(
cv2
.
CAP_PROP_FRAME_COUNT
))
skipFrame
=
fps
*
skipSeconds
capture
.
set
(
cv2
.
CAP_PROP_POS_FRAMES
,
skipFrame
)
print
(
f
"
Reading video file:
{
videoFile
}
"
)
print
(
f
"
Data:
{
width
}
x
{
height
}
@
{
fps
}
Hz
"
)
print
(
f
"
Skipping to frame
{
skipFrame
}
of total
{
frames
}
frames
"
)
last
=
None
frame
=
None
...
...
@@ -76,7 +87,8 @@ state = {} # Leeres Dictionary als Zustandsobjekt
info
=
{
'
abs_diff
'
:
2
,
# Standard: 2+1 Bilder
'
dim
'
:
(
1920
,
1080
),
# Dimension des Videos
'
dim
'
:
(
width
,
height
),
# Dimension des Videos
'
scaled
'
:
(
1280
,
720
),
# Skalierung für die Filter
'
params
'
:
{}
# Leeres Dictionary für Filter-Parameter
}
...
...
@@ -86,7 +98,7 @@ while capture.isOpened():
# ret is the stat of the reading
ret
,
frame
=
capture
.
read
()
if
ret
==
True
:
frame
,
_
=
filters
.
resize
(
None
,
frame
,
None
)
frame
,
_
=
filters
.
resize
(
info
,
frame
,
None
)
# Trackbar-Parameter auslesen und setzen
info
[
'
params
'
][
'
mix
'
]
=
cv2
.
getTrackbarPos
(
'
Diff_Mix
'
,
window
)
/
100.0
...
...
This diff is collapsed.
Click to expand it.
filters.py
+
16
−
5
View file @
bb3a348c
##############################################
# Modul: Computer Vision (SoSe23)
# Dozent: Prof. Dr-Ing. Gerhardt
#
# Erkennung eines Wasserstrahls
#
# Autoren: - Joel Steffens
# - Mohammad Khaleeliyeh
# - Midras Lappe
##############################################
import
cv2
as
cv
import
numpy
as
np
import
pandas
as
pd
...
...
@@ -175,21 +185,22 @@ def green_absfilter(info, image, state):
#
Resize image to 1280x720 pixels
#
Bild in andere Dimensionen skalieren
def
resize
(
info
,
image
,
state
):
res
=
cv
.
resize
(
image
,
(
1280
,
720
)
)
res
=
cv
.
resize
(
image
,
info
[
'
scaled
'
]
)
return
res
,
False
#
Convert to Gray scale image
#
Bild in Graustufen umwandeln
def
grayscale
(
info
,
image
,
state
):
res
=
cv
.
cvtColor
(
image
,
cv
.
COLOR_BGR2GRAY
)
return
res
,
False
# Schärfe des Bild erhöhen
def
median_blur
(
info
,
image
,
state
):
#
m
edian
of all the pixels under the kernel area
#
M
edian
-Blur auf Bild anwenden
blur
=
cv
.
medianBlur
(
image
,
7
)
#
adding tow images
#
beide Bilder zusammenfassen
sharp
=
cv
.
addWeighted
(
image
,
1.5
,
blur
,
-
0.5
,
0.0
)
return
sharp
,
False
...
...
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