예제 #1
0
def main():
    server=imagiz.TCP_Server(port=5553)
    server.start()
    cv2.namedWindow("frame3", cv2.WINDOW_NORMAL)

    fps = FPS().start()
    while True:
        try:
            message=server.receive()
            frame = cv2.imdecode(message.image,1)
            cv2.imshow("frame3",frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
            fps.update()
        except Exception as e:
            print(e)
            cv2.destroyAllWindows()

            break
    
    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))

    cv2.destroyAllWindows()
예제 #2
0
def main():
    global exitFlag
    server1 = imagiz.TCP_Server(port=5550)
    server1.start()

    cv2.namedWindow("frame1", cv2.WINDOW_NORMAL)
    # cv2.namedWindow("frame2", cv2.WINDOW_NORMAL)

    fps = FPS().start()
    while True:
        try:
            message1 = server1.receive()
            if message1.client_name == "cc1":
                cv2.imshow("frame1", message1.image)
            if message1.client_name == "cc2":
                print(message1.image)
                print("----------------------------------")
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
            fps.update()
        except Exception as e:
            print(e)
            cv2.destroyAllWindows()
            break
        except KeyboardInterrupt:
            cv2.destroyAllWindows()
            break

    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))

    cv2.destroyAllWindows()
예제 #3
0
def main():
    server1 = imagiz.TCP_Server(port=5550)
    server1.start()

    # cv2.namedWindow("frame1", cv2.WINDOW_NORMAL)
    # cv2.namedWindow("frame2", cv2.WINDOW_NORMAL)

    frame1 = np.zeros((256, 256, 3))
    frame2 = np.zeros((256, 256, 3))

    camera1 = pyfakewebcam.FakeWebcam('/dev/video0', 256, 256)
    camera2 = pyfakewebcam.FakeWebcam('/dev/video1', 256, 256)

    fps = FPS().start()
    while True:
        try:
            message1 = server1.receive()
            if message1.client_name == "cc1":
                # frame1 = cv2.imdecode(message1.image, 1)
                frame1 = message1.image
                frame1 = frame1[..., ::-1]
            if message1.client_name == "cc2":
                # frame2 = cv2.imdecode(message1.image, 1)
                frame2 = message1.image
                frame2 = frame2[..., ::-1]
                # cv2.imshow("frame2", frame2)
            # if message1.client_name == "cc3":
            #     # joints = cv2.imdecode(message1.image, 1)
            #     joints = message1.image
            #     # draw_joints(frame1, joints)
            #     # cv2.imshow("frame1", frame1)
            # cv2.imshow("frame1", frame1)
            # cv2.imshow("frame2", frame2)

            if frame1.any():
                # print(frame1.shape)
                camera1.schedule_frame(frame1)

            if frame2.any():
                # print(frame2.shape)
                camera2.schedule_frame(frame2)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
            fps.update()
        except Exception as e:
            print(e)
            cv2.destroyAllWindows()
            break
        except KeyboardInterrupt:
            cv2.destroyAllWindows()
            break

    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))

    cv2.destroyAllWindows()
예제 #4
0
def main():
    server1 = imagiz.TCP_Server(port=5550)
    server1.start()

    cv2.namedWindow("frame1", cv2.WINDOW_NORMAL)
    cv2.namedWindow("frame2", cv2.WINDOW_NORMAL)

    frame1 = np.zeros((256, 256, 3))
    frame2 = np.zeros((256, 256, 3))

    fps = FPS().start()
    while True:
        try:
            message1 = server1.receive()
            if message1.client_name == "cc1":
                # frame1 = cv2.imdecode(message1.image, 1)
                frame1 = message1.image
            if message1.client_name == "cc2":
                # frame2 = cv2.imdecode(message1.image, 1)
                frame2 = message1.image
                cv2.imshow("frame2", frame2)
            if message1.client_name == "cc3":
                # joints = cv2.imdecode(message1.image, 1)
                joints = message1.image
                draw_joints(frame1, joints)
                cv2.imshow("frame1", frame1)
                fps.update()
            # cv2.imshow("frame1", frame1)
            # cv2.imshow("frame2", frame2)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
            fps.update()
        except Exception as e:
            print(e)
            cv2.destroyAllWindows()
            break
        except KeyboardInterrupt:
            cv2.destroyAllWindows()
            break

    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))

    cv2.destroyAllWindows()
예제 #5
0
#!/usr/bin/env python
from importlib import import_module
import os
from flask import Flask, render_template, Response
import imagiz
import cv2
from EmotionDetection.face_detection import FaceClass

app = Flask(__name__)
server = imagiz.TCP_Server(8095)
server.start()
face_class = FaceClass()


@app.route('/')
def index():
    """Video streaming home page."""
    return render_template('index.html')


def gen():
    # import camera driver
    # Raspberry Pi camera module (requires picamera package)
    # from camera_pi import Camera
    if os.environ.get('CAMERA'):
        Camera = import_module('camera_' + os.environ['CAMERA']).Camera
    else:
        from camera import Camera
    camera = Camera()
    """Video streaming generator function."""
    while True:
예제 #6
0
 def __init__(self):
     threading.Thread.__init__(self, serverPort=5555)
     server = imagiz.TCP_Server(port=serverPort)
     server.start()
예제 #7
0
import imagiz
import cv2
server = imagiz.TCP_Server(9990)
server.start()
while True:
    message = server.receive()
    # print(m)
    frame = cv2.imdecode(mmessage.image, 1)
    cv2.imshow("", frame)
    cv2.waitKey(1)
예제 #8
0
import cv2
import imagiz

server = imagiz.TCP_Server(8011)
server.start()
while True:
    message = server.receive()
    frame = cv2.imdecode(message.image, 1)
    cv2.imshow(message.client_name, frame)
    cv2.waitKey(1)