client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((HOST,PORT))
screen_width = 0
screen_height = 0
while True:
client_socket.send("loc\n")
data = client_socket.recv(8192)
pos_coordinates = data.split()
if(not(pos_coordinates[-1] == "eom" and pos_coordinates[0] == "start")):
continue
if (screenw != int(pos_coordinates[2])):
screenw = int(pos_coordinates[2])
screenh = int(pos_coordinates[3])
blalba(pos_coordinates)
How can i get the average of 3 pos_coordinates list values ?
For example if pos_coordinates[8] contains the value 345, i want to get the average of that value and use the averaged value. the reason i want to do this, is because i am getting noise from the image detected through the camera and i thought the best way to go about this is to get the average of the values in order to get the value that i want. Any examples on how to do this?
For getting the average of the whole list;
If you just want to get the average of a subset, use a slice;
In python 3.x the explicit
floatconversion is not necessary anymore to get accurate division.