removed useless comments
This commit is contained in:
parent
38573dcd40
commit
52df356111
9
ds.py
9
ds.py
@ -3,7 +3,7 @@ import pygame
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
host = "192.168.1.136"
|
host = "192.168.1.136"
|
||||||
port=5802
|
port = 5802
|
||||||
screen = pygame.display.set_mode((640,480),0)
|
screen = pygame.display.set_mode((640,480),0)
|
||||||
|
|
||||||
|
|
||||||
@ -11,9 +11,7 @@ while True:
|
|||||||
clientsocket=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
clientsocket=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
clientsocket.connect((host, port))
|
clientsocket.connect((host, port))
|
||||||
received = []
|
received = []
|
||||||
# loop .recv, it returns empty string when done, then transmitted data is completely received
|
|
||||||
while True:
|
while True:
|
||||||
#print("esperando receber dado")
|
|
||||||
recvd_data = clientsocket.recv(230400)
|
recvd_data = clientsocket.recv(230400)
|
||||||
if not recvd_data:
|
if not recvd_data:
|
||||||
break
|
break
|
||||||
@ -22,11 +20,10 @@ while True:
|
|||||||
|
|
||||||
dataset = ''.join(received)
|
dataset = ''.join(received)
|
||||||
print(len(dataset))
|
print(len(dataset))
|
||||||
image = pygame.image.fromstring(dataset,(640,480),"RGB") # convert received image from string
|
image = pygame.image.fromstring(dataset,(640,480),"RGB")
|
||||||
screen.blit(image,(0,0)) # "show image" on the screen
|
screen.blit(image,(0,0))
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
# check for quit events
|
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
6
rpi.py
6
rpi.py
@ -20,12 +20,12 @@ floorCam.start()
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
connection, address = serversocket.accept()
|
connection, address = serversocket.accept()
|
||||||
goalImage = goalCam.get_image() # capture image
|
goalImage = goalCam.get_image()
|
||||||
floorImage = floorCam.get_image() # capture image
|
floorImage = floorCam.get_image()
|
||||||
merged = pygame.Surface([640,480])
|
merged = pygame.Surface([640,480])
|
||||||
merged.blit(goalImage,(0,0))
|
merged.blit(goalImage,(0,0))
|
||||||
merged.blit(floorImage,(320,0))
|
merged.blit(floorImage,(320,0))
|
||||||
data = pygame.image.tostring(merged,"RGB") # convert captured image to string, use RGB color scheme
|
data = pygame.image.tostring(merged,"RGB")
|
||||||
try:
|
try:
|
||||||
connection.sendall(data)
|
connection.sendall(data)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
Loading…
Reference in New Issue
Block a user