예제 #1
0
def test_reducer(frame, percentage, interpolation, result):
    """
    Testing frame size reducer function
    """
    if not (frame is None):
        org_size = frame.shape[:2]
    try:
        reduced_frame = reducer(frame, percentage, interpolation)
        logger.debug(reduced_frame.shape)
        assert not (reduced_frame is None)
        reduced_frame_size = reduced_frame.shape[:2]
        assert (100 * reduced_frame_size[0] //
                (100 - percentage) == org_size[0])  # cross-check width
        assert (100 * reduced_frame_size[1] //
                (100 - percentage) == org_size[1])  # cross-check height
    except Exception as e:
        if not (result):
            pytest.xfail(str(e))
        else:
            pytest.fail(str(e))
예제 #2
0
#define NetGear Client with `receive_mode = True` and defined parameter
client = NetGear(address = '192.168.0.12', port = '5454', protocol = 'tcp',receive_mode = True, pattern = 1, logging = True, **options)

# loop over
while True:

     # read frames from stream
    frame = stream.read()

    # check for frame if Nonetype
    if frame is None:
        break

    # reducer frames size if you want more performance, otherwise comment this line
    frame = reducer(frame, percentage = 30) #reduce frame by 30%

    # receive data from server and also send our data
    data = client.recv(return_data = frame)

    # check for data if None
    if data is None:
        break

    # extract server_data & frame from data
    server_data, frame = data

    # again check for frame if None
    if frame is None:
        break