Beispiel #1
0
def upgrade(file_path):
    device_names = hs.EnumerateDevices()
    if len(device_names) < 1:
        print("Error - No HS devices found.")
        quit()

    device = hs.Device(device_names[0])
    try:
        device.OpenDevice()
    except:
        print("Error - Cound not open HS device.")
        quit()

    print("HS Device opened normally.")

    try:
        device.UpdateApp(file_path)
    except:
        print("Error - Cound not upgrade HS device.")
        quit()

    print("Device upgrade successful.")
Beispiel #2
0
import numpy as np
import hsapi as hs
import cv2
device_list = hs.EnumerateDevices()  # 获取所有已连接的角蜂鸟
device = hs.Device(device_list[0])  # 获取Device实例

device.OpenDevice()  # 打开角蜂鸟设备

while (1):
    image = device.getImage(True)

    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

    gray[gray > 60] = 255
    gray[gray < 60] = 0

    cv2.imshow('aaa', gray)

    cv2.waitKey(15)

cv2.destroyAllWindows()
#! /usr/bin/env python3

# Copyright(c) 2018 Senscape Corporation.
# License: Apache 2.0

## Example of low level api

import numpy as np, cv2, sys, re
sys.path.append('../../api/')
import hsapi as hs

WEBCAM = False  # Set to True if use Webcam

# Load device
devices = hs.EnumerateDevices()
dev = hs.Device(devices[0])
dev.OpenDevice()

# Load CNN model
with open('../graphs/graph_sz', mode='rb') as f:
    b = f.read()
graph = dev.AllocateGraph(b)
dim = (227, 227)

# Load classes
classes = np.loadtxt('../misc/image_category.txt', str, delimiter='\t')

# Set camera mode
if WEBCAM: video_capture = cv2.VideoCapture(0)

ROI_ratio = 0.5