X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/3a3b3ed0b533fdd222a8a6d05a9a8c4fc09a3830..313d1f1c82163b5b9f6c3919b6d319964ec06f5e:/measure_energy_iot/image_compression.py?ds=sidebyside diff --git a/measure_energy_iot/image_compression.py b/measure_energy_iot/image_compression.py index 3000f67..4c0c555 100644 --- a/measure_energy_iot/image_compression.py +++ b/measure_energy_iot/image_compression.py @@ -1,6 +1,7 @@ from PIL import Image import time import cv2 +import subprocess import sys @@ -10,7 +11,7 @@ print("quality ",quality) im=Image.open("lena.jpg") elapsed_time=0 -for i in range(100): +for i in range(10): t = time.process_time() im.save("lena2.jpg",quality=quality) elapsed_time += time.process_time() - t @@ -20,9 +21,8 @@ print("time pil",elapsed_time) - elapsed_time=0 -for i in range(100): +for i in range(10): t = time.process_time() im2=im.resize((256, 256)) im2.save("lena3.jpg",quality=quality) @@ -30,7 +30,7 @@ for i in range(100): print("time resize + pil",elapsed_time) - +""" img = cv2.imread('lena.jpg') @@ -45,7 +45,7 @@ for i in range(100): print("time cv2",elapsed_time) - +elapsed_time=0 for i in range(100): t = time.process_time() resized = cv2.resize(img, (256,256), interpolation=cv2.INTER_LINEAR) @@ -53,3 +53,26 @@ for i in range(100): elapsed_time += time.process_time() - t print("time resize + cv2",elapsed_time) +""" + + +elapsed_time=0 +t = time.process_time() +for i in range(10): + + proc=subprocess.Popen("scp lena2.jpg bilbo.iut-bm.univ-fcomte.fr:/tmp", shell=True) + proc.wait() + +elapsed_time += time.process_time() - t +print("ssh normal",elapsed_time) + + +elapsed_time=0 +t = time.process_time() +for i in range(10): + + proc=subprocess.Popen("scp lena3.jpg bilbo.iut-bm.univ-fcomte.fr:/tmp", shell=True) + proc.wait() + +elapsed_time += time.process_time() - t +print("ssh reduce",elapsed_time)