#!/usr/bin/env python3
# vim:ts=4:sts=4:sw=4:expandtab

import cv2
import os
import random

signal_length = 0.5

width = 780
height = 780

video = cv2.VideoCapture('polibiusz.mp4')
framerate = video.get(cv2.CAP_PROP_FPS)

while True:
    ok, frame = video.read()
    if not ok:
        break
    frame = cv2.resize(frame, (width, height))

    x = random.randrange(width)
    y = random.randrange(height)
    red_value = frame[x,y,2]
    print(f'Wartość RED w punkcie ({x},{y}) wynosi {red_value}')

    cv2.imshow('Obrazek', frame)
    cv2.waitKey(int(1000/framerate))


cv2.destroyAllWindows()
video.release()
