Code Monkey home page Code Monkey logo

easyaiortc's Introduction

demo

easyaiortc

これはGoogle Colabとの映像通信をリアルタイムに行うためのライブラリです。
これによりGoogle Colab上での映像のプレビューや、Webカメラからの映像送信が容易になります。
内部ではaiortcを用いてAppRTC上にルームを作成し、その上で映像の送受信を行なっています。

Google Colabで試す

Open In Colab

使い方

1. ライブラリのインストール

apt install libavdevice-dev libavfilter-dev libopus-dev libvpx-dev pkg-config
pip install git+https://github.com/wakewakame/easyaiortc.git

2. Webカメラの映像を回転するサンプルプログラム

import easyaiortc
import cv2

# 接続の開始
rtc = easyaiortc.EasyAppRTC(preview=True, width=640, height=320)

# 回転角度
deg = 0

try:
    # 接続されている間はループ
    while rtc.is_alive():
        # 映像の受信
        img = rtc.get()
        if img is None:
            continue

        # 受信した映像を回転
        n_h, n_w, n_ch = img.shape
        M = cv2.getRotationMatrix2D((n_w / 2, n_h / 2), deg, 1)
        img = cv2.warpAffine(img, M, (n_w, n_h))
        deg += 1

        # 回転した映像を送信
        rtc.put(img)

# Ctrl+Zで終了
except KeyboardInterrupt:
    pass

easyaiortc's People

Contributors

wakewakame avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.