コード例 #1
0
ファイル: camera.py プロジェクト: congvm-cs/camera_streaming
    def __init__(self):
        # Using OpenCV to capture from device 0. If you have trouble capturing
        # from a webcam, comment the line below out and use a video file
        # instead.
        self.video = cv2.VideoCapture(0)

        if not self.video.isOpened():
            raise("Cannot open Camera!")
            
        self.qrscanner = QRScanner()
コード例 #2
0
ファイル: camera.py プロジェクト: congvm-cs/camera_streaming
class VideoCamera(object):
    def __init__(self):
        # Using OpenCV to capture from device 0. If you have trouble capturing
        # from a webcam, comment the line below out and use a video file
        # instead.
        self.video = cv2.VideoCapture(0)

        if not self.video.isOpened():
            raise("Cannot open Camera!")
            
        self.qrscanner = QRScanner()

    def __del__(self):
        self.video.release()
    
    def get_frame(self):
        _, image = self.video.read()
        image = self.qrscanner.scan(image)
        # We are using Motion JPEG, but OpenCV defaults to capture raw images,
        # so we must encode it into JPEG in order to correctly display the
        # video stream.
        _, jpeg = cv2.imencode('.jpg', image)
        return jpeg.tobytes()
コード例 #3
0
from keystore import KeyStore

from qrscanner import QRScanner
from usbhost import USBHost
from rng import get_random_bytes

from pin import Secret, Key
from platform import simulator, storage_root, USB_ENABLED, DEV_ENABLED
from ucryptolib import aes
from hashlib import hmac_sha512

from io import BytesIO

reckless_fname = "%s/%s" % (storage_root, "reckless.json")

qr_scanner = QRScanner()
usb_host = USBHost()

# entropy that will be converted to mnemonic
entropy = None
# network we are using
network = None
# our key storage
keystore = KeyStore(storage_root=storage_root)

DEFAULT_XPUBS = []
ALL_XPUBS = []

SUPPORTED_SCRIPTS = {
    "p2wpkh": "Native Segwit",
    "p2sh-p2wpkh": "Nested Segwit",