senseye_cameras package

Submodules

senseye_cameras.loop_thread module

class senseye_cameras.loop_thread.LoopThread(frequency=1000, stop_on_error=False)[source]

Bases: threading.Thread

Class to follow common pattern of looping thread

loop()[source]
on_error(e)[source]
on_start()[source]
on_stop()[source]
restart()[source]

Restart at thread Seperated from start / stop because thread functions like join / is alive May return unexpected results from this

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

stop(join=True)[source]

senseye_cameras.reader module

class senseye_cameras.reader.Reader(q, on_read=None, type='usb', config=None, id=0, frequency=None, reading=False, writing=False)[source]

Bases: senseye_cameras.loop_thread.LoopThread

Reads data into a queue.

loop()[source]
on_stop()[source]

senseye_cameras.safe_queue module

class senseye_cameras.safe_queue.SafeQueue(maxsize=0, module='Generic')[source]

Bases: queue.Queue

Class that extends Python Queue to safely handle exceptions from Queue accessor methods.

get(block=True, timeout=None)[source]

Attempt to retrieve an element from the queue, handling the Empty exception if it arises. Returns the item or None if dequeue is unsuccessful.

Note: It is possible that a None object was enqueued. Checking for a None value on a get() call will be ambiguous in this case. It may mean the original item was None or that the queue is empty.

get_nowait()[source]

Non-blocking get with exception handling.

put(item, block=True, timeout=None, force=False)[source]

Attempt to insert an item into the queue, handling the Full exception if it arises. Return True if item is successfully enqueued. If a force was required, return the dequeued item.

put_nowait(item, force=False)[source]

Non-blocking put with exception handling.

remove_existing(num_elements=None)[source]

Pops items from self queue and appends to a list. Mutates self queue by removing qsize elements.

Note: If you force an item to be input into the queue during this operation, you may clobber data. For example: - SafeQueue size is 10 when remove_existing() is called - SafeQueue maxsize is 10 - SafeQueue.put_nowait(an_item, force=True) - The first item is forced off, and may not have been grabbed into the list. - Using a mutex here may cause a deadlock.

to_list()[source]

Converts queue to a list.

senseye_cameras.stream module

class senseye_cameras.stream.Stream(input_type='usb', input_config=None, id=0, output_type='ffmpeg', output_config=None, path='.', input_frequency=None, output_frequency=None, reading=False, writing=False, on_read=None, on_write=None, queue_size=700)[source]

Bases: object

Links an Input with an Output.

Args:
input_type/input_config/id: see create_input. output_type/output_config/path: see create_output reading/writing (bool): whether to read/write on start. on_read (func): called on frame read. Function should take fn(data=None, timestamp=None) as args. on_read/on_write (func): called on frame write. Function should take fn(data=None)
set_path(path=None)[source]

Sets the writers’ path.

start_reading()[source]

Starts reading in frames.

start_writing()[source]

Starts writing frames.

stop()[source]
stop_reading()[source]

Stops reading in frames.

stop_writing()[source]

Stops writing frames.

senseye_cameras.writer module

class senseye_cameras.writer.Writer(q, on_write=None, type='ffmpeg', config=None, path=0, frequency=None, writing=False, input_config=None)[source]

Bases: senseye_cameras.loop_thread.LoopThread

Writes data from a queue into an output file.

flush()[source]
initialize_writer()[source]
loop()[source]
on_stop()[source]
set_path(path=None)[source]

Module contents

Senseye Camera Utility Package.

abstractions:
camera - a video/camera interface that produces frames. recorder - an interface that takes in frames and writes them to disk.

create a camera/recorder through the create_camera/create_recorder functions.