def test_sanity(): cam = create_input(type='usb', id=SAMPLE_VIDEO) cam.open() assert cam.input.isOpened() cam.close() assert cam.input is None
def test_read(): cam = create_input(type='usb', id=SAMPLE_VIDEO) cam.open() frame, timestamp = cam.read() assert frame is not None cam.close()
def test_read(): ''' Test reading from an ffmpeg camera. cam.open() will only run successfully if: 1. ffmpeg binaries on the system path 2. A camera ffmpeg can access. Thus, only run the test if camera.open() does not fail. ''' cam = None try: cam = create_input(type='ffmpeg', id=0) cam.open() except Exception as e: pytest.skip( f'Test could not be run; camera open failed with error: {e}') frame, _ = cam.read() assert frame is not None cam.close()
def test_read(): ''' Test reading from an pylon camera. cam.open() will only run successfully if: 1. the pylon sdk is installed 2. pypylon is installed 3. a pylon camera is connected Thus, only run the test if camera.open() does not fail. ''' cam = None try: cam = create_input(type='pylon', id=0) cam.open() except Exception as e: pytest.skip( f'Test could not be run; camera open failed with error: {e}') frame, _ = cam.read() assert frame is not None cam.close()
from senseye_cameras import create_input # initialize and open a usb camera camera = create_input(type='usb', id=0, config={}) # print documentation for the CameraUsb module # docs will show what key/value pairs can go into the config dictionary print(camera.__doc__) camera.open() frame, timestamp = camera.read() print(frame)
import inspect from pathlib import Path from senseye_cameras import create_input # get the path to the sample compressed video in the tests/resources folder video = str( Path( Path(inspect.getfile(inspect.currentframe())).parents[2].absolute(), 'tests/resources/usb_video.mp4')) # initialize and open a usb camera camera = create_input(type='usb', id=video, config={'res': (1920, 1080)}) camera.open() frame, timestamp = camera.read() print(frame)
from senseye_cameras import create_input # initialize and open an ffmpeg camera camera = create_input(type='ffmpeg', id=0, config={}) camera.open() frame, timestamp = camera.read() print(frame)
from senseye_cameras import create_input # initialize and open a pylon camera # a pylon camera can accept a path to a pfs file. # pfs files can be generated using the PylonViewer application that comes with the pylon Camera Software Suite. camera = create_input(type='pylon', id=0, config={'pfs': None}) camera.open() frame, timestamp = camera.read() print(frame)
def test_sanity(): cam = create_input(type='raw_video', id=SAMPLE_RAW_VIDEO) cam.open() cam.close() assert cam.input is None