rrmsutils package
Subpackages
Submodules
rrmsutils.analytics module
Wrapper for Analytics API
- class rrmsutils.analytics.Analytics(host='127.0.0.1', port=5020, base_path='')
Bases:
object
Wrapper for Analytics API
- get_configuration()
Gets the Analytics configuration
- Returns:
The configuration of the analytics service
- Return type:
- set_configuration(config: Configuration) bool
Sets the configuration to analytics service
- Parameters:
Configuration – The analytics service configuration
- Returns:
True in case of success, False in case of error
- Return type:
bool
rrmsutils.bips module
BIPS Microservice Client API
A thypical use case would be as follows:
from rrmsutils.bips import BIPS
from rrmsutils.models.bips.stream import Stream
from rrmsutils.models.bips.streamlist import StreamList
# Imports needed for bips consumer
import numpy as np
import bips
# Create BIPS client (by default will talk to address 127.0.0.1 and port 5050)
bips_service = BIPS()
# Create the Stream object for the desired stream
stream = Stream(name='camera1', uri='rtsp://127.0.0.1:5000/stream1')
ret = bips_service.add_stream(stream)
if not ret:
print("Something went wrong")
# Get Streams List
stream_list = bips_service.get_stream_list()
# Create bips consumer
item = stream_list.streams[0]
buffer = item.buffer
size = buffer.size
channel=item.name
buffers = item.buffers
backend = bips.Backends.kShm
in_order = True
logger = bips.Logger(bips.LoggerType.kSpd, "consumer.log")
logger.SetConsoleLevel(bips.Level.kWarning)
logger.SetLogfileLevel(bips.Level.kTrace)
consumer = bips.Consumer(backend,channel,buffers,size,in_order,logger)
num_iterations = 120
timeout = 6000000
# Start pulling buffers
for i in range(num_iterations):
buffer = consumer.Pull(timeout)
np_array = np.array(buffer.data, copy=False)
print(np_array[0])
consumer.Push(buffer, timeout)
# Delete stream
bips_service.delete_stream('camera1')
- class rrmsutils.bips.BIPS(host='127.0.0.1', port=5050)
Bases:
object
Clien for PTZ service
- Parameters:
host (str, optional) – BIPS service address. Defaults to “127.0.0.1”.
port (int, optional) – BIPS service port. Defaults to 5050.
- add_stream(stream: Stream) bool
Adds a stream to the service. The stream consists of a module that captures from an RTSP stream and generates a channel to share it with other processes.
- Parameters:
stream (rrmsutils.models.bips.stream.Stream) – The stream to be added.
- Returns:
True in case of success, False in case of error
- Return type:
bool
- delete_stream(name: str) bool
Deletes the given stream
- Parameters:
name (str) – The name of the stream to be deleted
- Returns:
True in case of success, False in case of error
- Return type:
bool
- get_stream_list()
Gets stream list
- Returns:
The list of current streams with its information.
- Return type:
rrmsutils.detection module
Wrapper for Detection API
- class rrmsutils.detection.Detection(host='127.0.0.1', port=5030, base_path='')
Bases:
object
Wrapper for Detection API
rrmsutils.ptz module
Wrapper for PTZ API
- class rrmsutils.ptz.PTZ(host='127.0.0.1', port=5020)
Bases:
object
Wrapper for PTZ API
- get_position()
Gets the camera position
- Returns:
The camera position or None in case of error
- Return type:
- get_stream()
Gets the PTZ stream
- Returns:
The camera stream information or None in case of error
- Return type:
- get_zoom()
Gets the camera zoom
- Returns:
The camera zoom or None in case of error
- Return type:
- set_position(position: Position) bool
Sets the camera position
- Parameters:
position (Position) – The camera position
- Returns:
True in case of success, False in case of error
- Return type:
bool
- set_stream(stream: Stream) bool
Sets the PTZ stream
- Parameters:
stream (rrmsutils.models.ptz.stream.Stream) – The camera stream information
- Returns:
True in case of success, False in case of error
- Return type:
bool
rrmsutils.schemagenerator module
- class rrmsutils.schemagenerator.SchemaGenerator(**kwargs)
Bases:
object
- connect_redis(host, port, stream)
Connects object to a redis server.
- Parameters:
host (str) – Redis server host ex: “0.0.0.0”
port (int) – Redis server port ex: 6387
stream (str) – Name of redis stream to output ex: “owl”
- Returns:
none