Skip to content
Snippets Groups Projects
Commit bdf1d1d2 authored by Leo Sutevski's avatar Leo Sutevski
Browse files

.

parent 0e45e592
No related branches found
No related tags found
No related merge requests found
......@@ -210,25 +210,25 @@ class MemoryFrame:
def _getImage(self):
'''Takes in an numpy array and converts it into grayscale image and encodes into base64'''
t = time.time()
#t = time.time()
arr = (self._readFrame()*255//1023).astype(np.uint8)
t1 = time.time()
#t1 = time.time()
# Encode the image data as a PNG
buffer = io.BytesIO()
writer = png.Writer(width=arr.shape[1], height=arr.shape[0], greyscale = 'True')
writer.write(buffer, arr)
t2 = time.time()
#t2 = time.time()
encoded = base64.b64encode(buffer.getvalue()).decode('utf-8')
t3 = time.time()
print("----------------------------------------------")
print("Time elapsed during frame grabbing: {}".format(t1-t))
print("Time elapsed during writing into a buffer: {}".format(t2-t1))
print("Time elapsed during encoding: {}".format(t3-t2))
print("Total elapsed time: {}".format(t3-t))
print("----------------------------------------------")
#t3 = time.time()
#print("----------------------------------------------")
#print("Time elapsed during frame grabbing: {}".format(t1-t))
#print("Time elapsed during writing into a buffer: {}".format(t2-t1))
#print("Time elapsed during encoding: {}".format(t3-t2))
#print("Total elapsed time: {}".format(t3-t))
#print("----------------------------------------------")
return encoded
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment