receiver.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pdc-project 作者: ealain 项目源码 文件源码
def receive():
    '''
    1. Locate screen
    2. Follow the variations of intensity in the screen
    '''
    sampling_period = 1/SAMPLING_FREQUENCY
    f = open(EXCHANGE_FILE_PATH, 'w')
    f.write('')
    x,y,w,h = screen_position()
    if((x,y,w,h) == (-1,-1,-1,-1)):
        print("Unable to detect screen")
        return
    cap = cv2.VideoCapture(0)
    values = []
    try:
        while(True):
            ret, frame = cap.read()
            sub_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)[y:y+h, x:x+w]
            values.append(str(np.mean(sub_frame)))
    except KeyboardInterrupt:
        pass
    f.write('\n'.join(values))
    f.close()

    decode()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号