-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_data.py
More file actions
36 lines (30 loc) · 867 Bytes
/
save_data.py
File metadata and controls
36 lines (30 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import config
import sys
import os
from datetime import datetime as DateTime
import cv2
#erzeuge Verzeichnis für Bilder
def createImageFolder():
print('speichere Bilder')
#Dateiname (Datum- und Zeitstempel)
filedir = config.SAVEDATA_BASEDIR+ '/' + DateTime.now().strftime(config.FILENAME_DATE_FORMAT)
#Wechsele in das neue Verzeichnis
os.mkdir(filedir)
os.chdir(filedir)
#speichere Bilder im Verzeichnis
def saveImages(file, image):
if saveStat == True:
cv2.imwrite(file, image)
elif saveStat == False:
pass
#Abfrage Bilder speichern
def saveToDisk():
getKey = input('Bilder speichern? [j/n] ')
if getKey == 'j':
createImageFolder()
global saveStat
saveStat = True
elif getKey == 'n':
print('weiter ohne Speichern')
else:
print('falsche Tastatureingabe')