diff --git a/client.py b/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7cb6c686155abc72d86e4496cd7d41ff35e5f582 --- /dev/null +++ b/client.py @@ -0,0 +1,104 @@ +# import cv2 +# import socket +# import io +# import struct + +# # Define connection details (replace with your actual values) +# HOST = '144.126.254.143' # IP address of the receiving device +# PORT = 5555 # Port number for communication + +# # Create a socket connection +# connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +# connection.connect((HOST, PORT)) + +# print("Starting camera using OpenCV...") + +# # Initialize video capture using OpenCV +# cap = cv2.VideoCapture(0) # Change 0 to the video source index if needed + +# while True: +# # Capture frame-by-frame +# ret, frame = cap.read() + +# # Check if frame capture is successful +# if not ret: +# print("Error: Frame not captured") +# break + +# # Encode frame as JPEG +# _, jpeg_buffer = cv2.imencode('.jpg', frame) + +# # Create a stream-like object from the JPEG buffer +# stream = io.BytesIO(jpeg_buffer.tobytes()) + +# # Get the stream's current position (similar to stream.tell()) +# stream_length = stream.tell() + +# # Send frame size (4 bytes) in little-endian format +# connection.sendall(struct.pack('