Skip to content
Snippets Groups Projects
Commit bb3a348c authored by Joel Steffens's avatar Joel Steffens
Browse files

Kleinere Verbesserungen

parent c0d8c3fe
Branches
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
# Erkennung eines Wasserstrahls
#
# Autoren: - Joel Steffens
# - Mohammend Ka
# - Mohammad Khaleeliyeh
# - 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
......
##############################################
# 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):
# median of all the pixels under the kernel area
# Median-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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment