# (C) WiSi-Testpilot 2022
#letzte Änderung 10.7.2022
import glob
import datetime
import numpy as np
import cv2
import time
import math as m
nfdetect = 1 # Noise Floor Detector
nfmittelwert = 0.0
raucherraus = 0
filter = 0
debug = 0 #: 1 Einzelschritt nur mit Signal, 2: bei Fehler halten, 3 bei Singlet triplet... halten, 4 bei Signal >= 10000 halten
sname = " V28.7, alle, Discone" #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Turnstile X-Yagi Discone
k30 = 3 ##################### 1 <Schwelle, 2 >=3000, 3 =alle
Schwelle = 50
#path = glob.glob("C:/Users/wilsi/Desktop/alte-YX-Juni/GRAVES-XY-Vv_220609*.jpg")
#path = glob.glob("C:/Users/wilsi/Desktop/XYagi-Aug1-21/GRAVES-XY-Vv_220815*.jpg")
#path = glob.glob("C:/Users/wilsi/Desktop/Discone-Juli-bis31/discone-Vv_220731*.jpg")
path = glob.glob("C:/Users/wilsi/Desktop/Discone-Aug1-21/discone-Vv_220814*.jpg")
#path = glob.glob("C:/Users/wilsi/Desktop/alt-Discone/Discone-Vv_220619*.jpg")
#path = glob.glob("C:/Users/wilsi/Desktop/Met-April22XY-1-30/GRAVES-XY-Vv_220412*.jpg")
#path = glob.glob("E:/xtest/draussen-Vv_220722*.jpg")
#path = glob.glob("F:/Meteor-ROHdaten/Dez2021_12-31/DezXY12-24/GRAVES-XY-Vv_211222*.jpg")
# F:\Meteor-ROHdaten\Dez2021_12-31\DezXY12-24
#E:E:\Meteor-ROHdaten\Dez2021_1-11\DezXY1-11
#path = glob.glob("E:/Meteor-ROHdaten/Dez2021_1-11/DezXY1-11/GRAVES-XY-Vv_211211*.jpg")
#path = glob.glob("E:/Meteor-ROHdaten/Dez2021_12-31/DezXY12-24/GRAVES-XY-Vv_211214*.jpg")
#path = glob.glob("F:/Meteor-ROHdaten/Dez2021_12-31/DezDiscone12-24/GRAVES_Discone_211221*.jpg")
#path = glob.glob("F:/Meteor-ROHdaten/Jan2022_1-31/Jan22XY-1-27/GRAVES-XY-Vv_220103*.jpg")
#path = glob.glob("F:/Meteor-ROHdaten/Jan2022_1-31/Jan22DiHV-1-27/GRAVES_Discone_220104*.jpg")
#F:\Meteor-ROHdaten\Jan2022_1-31\Jan22DiHV-1-27
Magenta = (147, 20, 255)
YELLOW = (0, 255, 255)
Yellow = (0, 255, 255)
DarkOrange = (15, 185, 255) #Gold
#DarkOrange = (0, 140, 255) # alt
lite_MAGENTA = (255, 0, 255)
GREEN = (20, 255, 20,)
BLUE = (255, 0, 0)
WHITE = (200, 200, 200)
light_BLUE = (255, 191, 0)
Rose = (200, 200, 255)
lRED = (20, 20, 255) # b g r
RED = (0, 0, 255) # b g r
OrangeRed = (0, 190, 255) # b g r fast gelb
darkOlive = (40, 120, 40)
Olive = (150, 255, 150)
bg = np.zeros((550, 1900, 3), np.uint8) # Result Screen
summe_mini = np.zeros((61), np.uint8)
summe_fl = np.zeros((26), np.single)
log_summe_fl = np.zeros((26), np.single)
summe_anz = np.zeros((26), np.uint32)
summe_10min = np.zeros((145), np.uint32)
fsumme_10min = np.zeros((145), np.single)
su1 = np.zeros((26), np.uint32)
su10 = np.zeros((26), np.uint32)
su100 = np.zeros((26), np.uint32)
su300 = np.zeros((26), np.uint32)
su1000 = np.zeros((26), np.uint32)
su10000 = np.zeros((26), np.uint32)
histogramm = np.zeros((540, 510, 3), np.uint8)
y_t_color = 0
dicke = 0
fl = 0
sugesamt = 0
fontScale = 0.6
fthickness = 1
font = cv2.FONT_HERSHEY_SIMPLEX
singlet = 0
doublet= 0
Long = 0
quartet = 0
splitit = 0
Ax = np.zeros((10), np.int32)
Ay = np.zeros((10), np.int32)
Bx = np.zeros((10), np.int32)
By = np.zeros((10), np.int32)
Bx[1] = 350
By[1] = 28 # war bis 8.Sept. 35
Ax[1] = 1125
Ay[1] = 417 # war am 8.Sept. 422, war 415 bis 17.4.2022
downx = 39
upy = 39
for j in range (2,10):
Ax[j] = Ax[1] - (downx * (j-1))
Ay[j] = Ay[1] + (upy * (j-1))
Bx[j] = Bx[1] - (downx * (j-1))
By[j] = By[1] + (upy * (j-1))
dx = Ax[1] -Bx[1]
dy = Ay[1] -By[1]
cqu = dx*dx + dy*dy
c = m.sqrt(cqu)
print (' c ', c)
seiten = 0
raucher = 0
for name in path:
# print(name)
seiten +=1
position = name.find(".jpg")
# 20210830001400
# 0123456789
zeit = name[position-10:position]
print()
print(zeit)
print ("Jahr Monat Tag St. Min. Sek.", '20' + name[position-12:position])
monat= zeit[0:2]
if monat == '01': Monat = 'Januar'
if monat == '02': Monat = 'Februar'
if monat == '03': Monat = 'Maerz'
if monat == '04': Monat = 'April'
if monat == '05': Monat = 'Mai'
if monat == '06': Monat = 'Juni'
if monat == '07': Monat = 'Juli'
if monat == '08': Monat = 'August'
if monat == '09': Monat = 'September'
if monat == '10': Monat = 'Oktober'
if monat == '11': Monat = 'November'
if monat == '12': Monat = 'Dezember'
print (Monat)
day= zeit[2:4]
ho = zeit[4:6] # Zeit aus Filenamen extrahieren
mi = zeit[6:8]
se = zeit[8:10]
print('Monat: ', monat)
print('Tag: ', day)
print (day + '.', Monat, '2022')
ctime = (float(ho) * 3600 ) + (float(mi) *60) + float(se) # X-Position aus Zeit berechnen
xa = round (ctime / 60)
if (mi == '00') and ((se == '00') or (se == '59') or (se == '01') ):
bg = cv2.line(bg,(xa,500),(xa, 515), WHITE, 2) # X ganze Stunden-Ticks
org = (xa, 530) # war 535
bg = cv2.putText(bg, ho, org, font, fontScale, WHITE, fthickness, cv2.LINE_AA)
if ((mi == '30') or (mi == '15') or (mi == '45')) and ((se == '00') or (se == '59') or (se == '01') ):
bg = cv2.line(bg,(xa,500),(xa, 510), WHITE, 1) # X 1/4 Stunden-Ticks
streamout = cv2.imread(name)
start_point = (0, 0) # Schrift wegmaskieren
end_point = (1920, 40)
xcolor = (100, 50, 30)
xthickness = -1
cv2.rectangle(streamout, start_point, end_point, xcolor, xthickness)
end_point = (80, 400)
cv2.rectangle(streamout, start_point, end_point, xcolor, xthickness)
start_point = (1300, 600)
end_point = (1535, 780)
cv2.rectangle(streamout, start_point, end_point, xcolor, xthickness)
start_point = (50, 400)
end_point = (770, 760)
cv2.line(streamout, start_point, end_point, xcolor,25)
if filter == 0: frame = streamout
if filter == 1: frame = cv2.GaussianBlur(streamout,(5, 5), cv2.BORDER_DEFAULT)
# frame = cv2.bilateralFilter(streamout,9,75,75)
# cv2.medianBlur(streamout,111)
# cv2.medianBlur(frame,7)
# cv2.bilateralFilter(streamout,9,75,75)
# cv2.imshow("gefiltert", frame)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # RGB zu HSV
maske = cv2.inRange(hsv, (10,70,70), (40,255,255)) # 15 37 Farbauswahl, siehe älterer Post
# cv2.imshow("SW-Maske", maske)
contours, hierarchy = cv2.findContours(maske, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE) # findet alle Konturen im Bild
# Noise Floor auswerten
if nfdetect == 1:
nfmittelwert = 0.0
if len(contours) == 0:
print ('#############################>>>>>>>>', len(contours))
for i in range (300, 401):
for j in range (200, 301):
for k in range (0, 3):
nfmittelwert = nfmittelwert + streamout[i, j, k]
cv2.circle(bg, (xa, 500 - int(nfmittelwert/5000)), 1 , Magenta, -1)
# print (nfmittelwert/5000)
# cv2.rectangle(streamout, (300, 200), (400, 300), YELLOW, 2)
# cv2.imshow("Bild fuer NF", streamout)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
for j in range (1,7):
cv2.line(streamout, (Ax[j], Ay[j]),(Bx[j], By[j]), light_BLUE, 2)
for j in range (7,10):
cv2.line(streamout, (Ax[j], Ay[j]),(Bx[j], By[j]), Magenta, 1)
cv2.drawContours(streamout, contours, -1, Olive, -1) # plottet alle Konturen im Bild
hoehe = np.zeros((10,5), np.single)
cav_save = np.zeros((10000,20), np.single)
anz = 0
canz = 0
hdiff = 0
for cc in contours: # Schleife über alle Konturen
anz += 1
flaeche = cv2.contourArea(cc)
xc,yc,wc,hc = cv2.boundingRect(cc)
rechteck = wc * hc
cv2.rectangle(streamout, (xc, yc), (xc + wc, yc + hc), light_BLUE, 2)
ux = int (xc + wc)
uy = int (yc + hc)
trigger = ux, uy
rect = cv2.minAreaRect(cc)
box = cv2.boxPoints(rect)
box = np.int0(box)
cv2.drawContours(streamout,[box],0, RED,2)
NBx, NBy = box[1]
left_top_red = NBx, NBy
cv2.circle(streamout, trigger, 6, light_BLUE, 2) # Kreis plotten
cv2.circle(streamout, left_top_red, 6, RED, 2) # roten Kreis plotten
if flaeche < 4: cv2.circle(streamout, left_top_red, 6, GREEN, -2) # grünen Kreis plotten
cv2.line(streamout, (Ax[1], Ay[1]), trigger, light_BLUE, 1)
for j in range (1,10):
dx = NBx -Bx[j]
dy = NBy -By[j]
aNB = m.sqrt(dx*dx + dy*dy)
dx = ux -Bx[j]
dy = uy -By[j]
a1 = m.sqrt(dx*dx + dy*dy)
# print ('a1 ',a1)
dx = ux -Ax[j]
dy = uy -Ay[j]
b1 = m.sqrt(dx*dx + dy*dy)
# print ('b1 ',b1)
try:
cos_A = (b1*b1 + cqu - a1*a1)/(2*b1*c)
except:
cos_A = 0.7
# print (' cos alpha ', cos_A)
try:
A = m.acos(cos_A)
except:
A = 99
sin_A = m.sin(A)
A = np.rad2deg(A)
# print ('Alpha ',A)
hoehe1 = b1 * sin_A
if j > 1: hdiff = hoehe_alt - hoehe1
hoehe_alt = hoehe1
print ('sin alpha ', sin_A,' Höhe1 ', hoehe1, 'Diff: ', hdiff)
hoehe[j,1] = hoehe1
hoehe[j,2] = aNB
hoehe[j,3] = b1
# end for
min_aNB = 10000
min_b1 = 10000
for j in range (1,9): # Zeilen
if (hoehe[j,1] < 52.35) and (hoehe[j+1,1] < 52.35): # 52.4
print (' Hit in Zeile: ', j)
cav_save[anz,j] = flaeche
if j < 6: canz +=1
if (hoehe[j,2] < min_aNB): min_aNB = hoehe[j,2]
if (hoehe[j,3] < min_b1): min_b1 = hoehe[j,3]
print (' anz ', anz, ' min_aNB ', min_aNB, ' min_b1 ', min_b1, ' Fläche ', flaeche)
cav_save[anz,10] = flaeche
cav_save[anz,11] = min_aNB
cav_save[anz,12] = min_b1
# end / for cc
for i in range (1,anz+1):
for j in range (1,6):
if (cav_save[i,j] > 0.0) and (cav_save[i,11] < 150): # min_aNB, war 100 150
for k in range (1,anz+1):
if cav_save[k,j] > 0.0:
cav_save[k,j] = -1 * cav_save[k,j]
canz -= 1
for i in range (1,anz+1):
for j in range (1,13):
print (cav_save[i,j], ' ', end = ' ')
print ('', end = "\r\n")
print ()
summenvector = np.zeros((13), np.single)
for i in range (1, anz+1):
for j in range (1,9):
summenvector[j] = summenvector[j] + cav_save[i,j]
for i in range (1,9):
print (summenvector[i], end = ' | ')
print ( '', end = "\r\n")
summe = 0
besetzte_zeilen = 0
for i in range (1,6):
if summenvector[i] > 0:
summe = summe + summenvector[i]
if summenvector[i] > 2: besetzte_zeilen += 1 # war 2
if summenvector[i] < 0:
bg = cv2.line(bg,(xa, 500),(xa, 485), RED, 1) # Y- Tick bei Knackimpuls
if debug == 2:
cv2.imshow("org", streamout)
print (' Summe: ', summe)
print (anz, ' ', canz, ' ', summe, ' bes. Z.>inc 1-2-1: ', besetzte_zeilen)
for i in range (1,6):
if summenvector[i] < 0 and anz > 30 and summe > 0:
bg = cv2.line(bg,(xa, 500),(xa, 515), RED, 1) # Y- Tick bei massiver Störung
summe = 0
if debug == 2:
cv2.imshow("org", streamout)
for i in range (1,6):
if summenvector[i] < 0 and summenvector[i+2] < 0:
bg = cv2.line(bg,(xa, 500),(xa, 515), RED, 1) # Y- Tick bei massiver Störung
summe = 0
if debug == 2:
cv2.imshow("org", streamout)
if raucherraus == 1:
print (' besetzte_zeilen ', besetzte_zeilen, ' Raucher ', raucher)
if besetzte_zeilen == 0 and raucher == 1:
raucher = 0
if besetzte_zeilen > 0 and raucher == 1:
summe = 0
if besetzte_zeilen >= 3:
if raucher == 0: raucher = 1
print (anz, ' ', canz, ' ', summe, ' bes. Z.>inc 1-2-1: ', besetzte_zeilen)
# cv2.imshow('test', streamout)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
if summe > 2:
if (canz >= 2) and (summe < 4):
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), Magenta, 2) # Y- Ticks #letzte Änderung 3.1.2022
print ('Magenta')
if debug == 2: cv2.imshow("org", streamout)
if (canz >= 3) and (summe < 7): # war 20
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), light_BLUE, 2) # Y- Ticks
print ('light_BLUE')
if debug == 2: cv2.imshow("org", streamout)
if (canz >= 5) and (summe < 90): #100
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), Yellow, 2) # Y- Ticks
print ('Yellow')
if debug == 2: cv2.imshow("org", streamout)
elif (canz >= 8) and (summe < 200):
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), BLUE, 2) # Y- Ticks
print ('BLUE')
if debug == 2: cv2.imshow("org", streamout)
elif (canz >= 12) and (summe < 1000):
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), Rose, 2) # Y- Ticks
print ('Rose')
if debug == 2: cv2.imshow("org", streamout)
if (summe > 100000):
summe = 0
bg = cv2.line(bg,(xa, 500),(xa, 510), RED, 2) # Y- Ticks
if debug == 2: cv2.imshow("org", streamout)
# end if summe > 2
print (anz, ' ', canz, ' ', summe)
print ()
splitit = 0
nsignale = 0
incrementer = 0
zsumme = 0
dicke = 3
if summe > 2:
for i in range (1,6):
if (summenvector[i] > 2) and (besetzte_zeilen <= 2):
nsignale += 1
fl = int(495 -100 * m.log10(summenvector[i]))
y_t_color = Magenta
if canz == 1: y_t_color = GREEN
if canz == 2: y_t_color = GREEN
if canz == 3: y_t_color = GREEN
if canz == 4: y_t_color = YELLOW
if canz == 5: y_t_color = YELLOW
if canz == 6: y_t_color = BLUE
if canz == 7: y_t_color = Rose
bg = cv2.circle(bg, (xa, fl), dicke , y_t_color, -1)
print (fl)
summe_fl[int(ho)+1] = summe_fl[int(ho)+1] + summenvector[i]
splitit = summenvector[i]
if (splitit >= 1) and (splitit < 10): su1[int(ho)+1] += 1
if (splitit >= 10) and (splitit < 100): su10[int(ho)+1] += 1
if (splitit >= 100) and (splitit < 300): su100[int(ho)+1] += 1
if (splitit >= 300) and (splitit < 1000): su300[int(ho)+1] += 1
if (splitit >= 1000) and (splitit < 10000): su1000[int(ho)+1] += 1
if (splitit >= 10000) and (splitit < 100000): su10000[int(ho)+1] += 1
fsumme_10min[6*int(ho)+ int(int(mi)/10)] = fsumme_10min[6*int(ho)+ int(int(mi)/10)] + summenvector[i]
if k30 == 1 and (splitit >= 1) and (splitit < Schwelle): summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
if k30 == 2 and (splitit >= 3000) and (splitit < 100000): summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
if k30 == 3: summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
#end if
#end for
if (besetzte_zeilen >= 3):
for i in range (1,6):
zsumme = zsumme + summenvector[i]
print ('zsumme : ',zsumme, ' summe ', summe)
fsumme_10min[6*int(ho)+ int(int(mi)/10)] = fsumme_10min[6*int(ho)+ int(int(mi)/10)] + summe
try:
fl = int(495 -100 * m.log10(zsumme))
except:
fl=1
bg = cv2.circle(bg, (xa, fl), dicke , RED, -1)
splitit = summe
nsignale = besetzte_zeilen
if (splitit >= 1) and (splitit < 10): su1[int(ho)+1] += 1
if (splitit >= 10) and (splitit < 100): su10[int(ho)+1] += 1
if (splitit >= 100) and (splitit < 300): su100[int(ho)+1] += 1
if (splitit >= 300) and (splitit < 1000): su300[int(ho)+1] += 1
if (splitit >= 1000) and (splitit < 10000): su1000[int(ho)+1] += 1
if (splitit >= 10000) and (splitit < 100000): su10000[int(ho)+1] += 1
summe_fl[int(ho)+1] = summe_fl[int(ho)+1] + summe
if k30 == 1 and (splitit >= 1) and (splitit < Schwelle): summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
if k30 == 2 and (splitit >= 3000) and (splitit < 100000): summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
if k30 == 3: summe_10min[6*int(ho)+ int(int(mi)/10)] += 1
if (besetzte_zeilen == 1): incrementer = 1
if (besetzte_zeilen == 2): incrementer = 2
if (besetzte_zeilen >= 3):
incrementer = 1
# cv2.imshow('test', streamout)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
if summe > 10000 and debug == 4: # > 10000
print(zeit)
cv2.imshow('test', streamout)
cv2.waitKey(0)
cv2.destroyAllWindows()
summe_anz[int(ho)+1] = summe_anz[int(ho)+1] + incrementer
if (summe >= 1) and (summe < 100000): sugesamt = sugesamt + incrementer
if nsignale == 1: singlet += 1
if nsignale == 2: doublet += 1
if nsignale == 3: Long += 1
if nsignale == 4: quartet += 1
if (nsignale > 1) and (debug == 3): cv2.imshow("org", streamout)
print ('Singlet:', singlet, ' Doublet:', doublet, ' Long:', Long)
print (name[position-12:position], ' alle zusammen ',int(sugesamt))
print ('-------------------------------------------------------------------------')
for i in range (1,25):
print (summe_fl[i], end = ' |')
if (debug == 1): # and (summe > 2):
cv2.imshow('test', streamout)
if debug > 0:
cv2.waitKey(0)
cv2.destroyAllWindows()
fl_max = 0
fl_max_i = 0
fl_sum = 0
print (' Histogramm Flaechen ')
for i in range (1,25):
fl_sum = fl_sum + summe_fl[i]
if fl_max < summe_fl[i]:
fl_max = summe_fl[i]
fl_max_i = i
print (summe_fl[i], end = ' |')
print ( '', end = "\r\n")
anz_max = 0
anz_max_i = 0
print (' Histogramm Anzahl ')
for i in range (1,25):
if anz_max < summe_anz[i]:
anz_max = summe_anz[i]
anz_max_i = i
print (summe_anz[i], end = ' |')
print ( '', end = "\r\n")
print (seiten)
for i in range (0, 12): print (i // 6,' ',summe_10min[i]) # 144
for i in range (0, 12): print (i // 6,' ',fsumme_10min[i]) # 144
fontScale1 = 0.4
for i in range (1,25):
cv2.rectangle(histogramm, (i*20, 250), ((i * 20) +10, 250 - int(summe_fl[i]/333.33)), RED, -1)
cv2.rectangle(histogramm, (i*20, 500), ((i * 20) +10, 500 - summe_anz[i]*3), Yellow, -1) # *4
# cv2.rectangle(histogramm, (i*20 +2, 500), ((i * 20) +8, 500 - summe_anz[i]*2), darkOlive, -1) # Test
org = (int(i*19.9), 520)
cv2.putText(histogramm, str(i-1), org, font, fontScale1, WHITE, fthickness, cv2.LINE_AA)
# 250 -75 -75
cv2.line(histogramm,(30, 175),(490, 175), darkOlive, 1)
cv2.line(histogramm,(30, 100),(490, 100), darkOlive, 1)
cv2.putText(histogramm, '25k', (4, 175), font, fontScale1, Olive, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, '50k',(4, 100), font, fontScale1, Olive, fthickness, cv2.LINE_AA)
# 500 -75 -75
cv2.line(histogramm,(20, 425),(490, 425), darkOlive, 1)
cv2.line(histogramm,(20, 350),(490, 350), darkOlive, 1)
cv2.putText(histogramm, '25', (4, 425), font, fontScale1, Olive, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, '50', (4, 350), font, fontScale1, Olive, fthickness, cv2.LINE_AA)
cv2.line(bg,(1,1),(1,500),(WHITE),2)
cv2.line(bg,(1,499),(1900,499), WHITE,2) # Skala
for j in range (1,5):
bg = cv2.line(bg,(0, j * 100),(15, j * 100), WHITE,2) # Y- Ticks
off = 4
cv2.putText(bg, '1', (5, 500-off), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, '10', (5, 400-off), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, '100', (5, 300-off), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, '1000', (5, 200-off), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, '10000', (5, 100-off), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, '100000', (5, 20), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg, 'Size/Pixel', (15, 55), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg,'Time / UTC', (580, 543), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(bg,'WiSi 2022', (1350,543), font, 0.5, RED, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, ' Summe Flaechen: '+str(int(fl_sum)), (10, 30), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, ' max: '+ str(int(fl_max)) + ' um '+ str(fl_max_i - 1)+ ' h', (10, 50), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, ' Anzahl: '+str(int(sugesamt)), (10, 280), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.putText(histogramm, ' max: '+str(anz_max) + ' um ' + str(anz_max_i - 1) + ' h', (10, 300), font, fontScale, WHITE, fthickness, cv2.LINE_AA)
cv2.imshow(' ' + day +'. ' + Monat +' 2022, Histogramme, Zeit in UTC, ', histogramm)
cv2.imshow(' ' + day +'. ' + Monat +' 2022, Logarithmus der Flaechen der Konturen' + sname, bg)
spalte1 = 0
spalte10 = 0
spalte100 = 0
spalte300 = 0
spalte1000 = 0
spalte10000 = 0
for i in range (1,25):
spalte1 = spalte1 + su1[i]
spalte10 = spalte10 + su10[i]
spalte100 = spalte100 + su100[i]
spalte300 = spalte300 + su300[i]
spalte1000 = spalte1000 + su1000[i]
spalte10000 = spalte10000 + su10000[i]
fanz = 0.0
sanz = 'string'
with open('datum.txt', 'w') as f:
f.write(' Aufnahmedatum ' + day + '. '+ Monat + ' 2022' + sname + '\n')
f.write(' ausgewertet am: ' + time.strftime("%d/%m/%Y, %H:%M:%S" + '\n'))
f.write(' Anz Fl Gr 1-10 10-100 100-300 300-1k 1k-10k 10k-100k #Platzhalter# '+ '\n')
for j in range (1, 25):
susi = ("{:8.1f}".format(summe_fl[j]))
fanz = float(summe_anz[j])
sanz = ("{:4.0f}".format(fanz))
susi1 = ("{:8.0f}".format(su1[j]))
susi10 = ("{:8.0f}".format(su10[j]))
susi100 = ("{:8.0f}".format(su100[j]))
susi300 = ("{:8.0f}".format(su300[j]))
susi1k = ("{:8.0f}".format(su1000[j]))
susi10k = ("{:8.0f}".format(su10000[j]))
# f.write(' ' + str(round(j-1)).zfill(2) + ' UTC ' + sanz + ' ' + susi + susi1 + susi10 + susi100 + susi300 + susi1k +
# susi10k + ' |' + ' hier hin 1 2 3 4 5 6 \n')
f.write(' ' + str(round(j-1)).zfill(2) + ' UTC ' + sanz + ' ' + susi + susi1 + susi10 + susi100 + susi300 + susi1k +
susi10k + ' |' + ' \n')
susi1 = ("{:8.0f}".format(spalte1))
susi10 = ("{:8.0f}".format(spalte10))
susi100 = ("{:8.0f}".format(spalte100))
susi300 = ("{:8.0f}".format(spalte300))
susi1k = ("{:8.0f}".format(spalte1000))
susi10k = ("{:8.0f}".format(spalte10000))
f.write(' -----------------------------------------------------------------------------'+ '\n')
f.write(' Summen:' + "{:6.0f}".format(sugesamt) + "{:10.1f}".format(fl_sum) + susi1 + susi10 + susi100 + susi300 + susi1k + susi10k + ' \n')
f.write('\r\n')
for i in range (0, 144):
susi_i = ("{:8.0f}".format(i//6))
susi_10min = ("{:8.0f}".format(summe_10min[i]))
if i > 0: f.write(' ' + susi_i + susi_10min + ' \n')
if i == 0: f.write(' ' + susi_i + susi_10min + ' Aufnahmedatum ' + day + '. '+ Monat + ' 2022' + sname + '\n')
f.write('\r\n')
for i in range (0, 144):
susi_i = ("{:8.0f}".format(i//6))
susi_10min = ("{:8.0f}".format(fsumme_10min[i]))
if i > 0: f.write(' ' + susi_i + susi_10min + ' \n')
if i == 0: f.write(' ' + susi_i + susi_10min + ' Aufnahmedatum ' + day + '. '+ Monat + ' 2022' + sname + '\n')
f.write('\r\n')
cv2.waitKey(0)
cv2.destroyAllWindows()