-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageProcessingService.py
More file actions
52 lines (32 loc) · 1.09 KB
/
Copy pathimageProcessingService.py
File metadata and controls
52 lines (32 loc) · 1.09 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python
import sys
from PIL import Image
from io import BytesIO
import datetime
import example
import pgservices
import base64
def processImageFromHistoricalData(imgByteArray,filename):
image = base64.b64decode(imgByteArray)
im = Image.open(BytesIO(image))
dateepoch = filename.split("_")
substring = dateepoch[1].split(".jpg")
camera = int(substring[0])
date = datetime.datetime.fromtimestamp(int(dateepoch[0])/1000)
imageInfo = example.getImageInfo(im, camera, date)
print(imageInfo)
pgservices.insertCameraData(imageInfo)
def processImageInfoFromLiveData(imgByteArray,camId):
im = Image.open(BytesIO(imgByteArray))
date = datetime.now()
imageInfo = example.getImageInfo(im, int(camId), date)
print(imageInfo)
pgservices.insertCameraData(imageInfo)
#TODO Bewerten ob erhoehtes Verkehraufkommen vorliegt
def main():
#print("test")
#print("Key: "+sys.argv[1]+" Value: "+ sys.argv[2])
print(sys.argv[2])
processImageFromHistoricalData(sys.argv[1],sys.argv[2])
if __name__ == "__main__":
main()