npu.lib.applications package#

Submodules#

npu.lib.applications.videoapps module#

class npu.lib.applications.videoapps.ColorDetectVideoProcessing(videosource=0)#

Bases: VideoApplication

Color Detect Video processing

rtps = {'thresholdValue1l': {'max': 255, 'min': 0, 'name': 'Hue range 0', 'rangehigh': 'thresholdValue1u', 'type': 'hueslider'}, 'thresholdValue2l': {'max': 255, 'min': 0, 'name': 'Hue range 1', 'rangehigh': 'thresholdValue2u', 'type': 'hueslider'}}#
start()#

Start the video processing

class npu.lib.applications.videoapps.ColorThresholdVideoProcessing(videosource=0)#

Bases: VideoApplication

Color Threshold Video processing

rtps = {'thresholdType': {'name': 'Type', 'options': [('BINARY', [0, 0]), ('BINARY_INV', [1, 0]), ('TRUNC', [2, 0]), ('TOZERO', [3, 0]), ('TOZERO_INV', [4, 0])], 'pair': 'thresholdValue4', 'type': 'dropdownpair'}, 'thresholdValue1': {'max': 255, 'min': 0, 'name': 'Red', 'type': 'slider'}, 'thresholdValue2': {'max': 255, 'min': 0, 'name': 'Green', 'type': 'slider'}, 'thresholdValue3': {'max': 255, 'min': 0, 'name': 'Blue', 'type': 'slider'}}#
class npu.lib.applications.videoapps.DenoiseDPVideoProcessing(videosource=0)#

Bases: VideoApplication

Denoising Data Parallel Video processing

class npu.lib.applications.videoapps.DenoiseTPVideoProcessing(videosource=0)#

Bases: VideoApplication

Denoising Task Parallel Video processing

class npu.lib.applications.videoapps.EdgeDetectVideoProcessing(videosource=0)#

Bases: VideoApplication

Edge Detect Video processing

rtps = {'alpha': {'max': 16384, 'min': 0, 'name': 'edges', 'type': 'slider'}, 'beta': {'max': 16384, 'min': 0, 'name': 'color overlaid', 'type': 'slider'}, 'thresholdValue': {'max': 255, 'min': 0, 'name': 'threshold', 'type': 'slider'}}#
start()#

Start the video processing

class npu.lib.applications.videoapps.ScaledColorThresholdVideoProcessing(videosource=0)#

Bases: VideoApplication

Color Threshold Video processing

rtps = {'thresholdType': {'name': 'Type', 'options': [('BINARY', [0, 0]), ('BINARY_INV', [1, 0]), ('TRUNC', [2, 0]), ('TOZERO', [3, 0]), ('TOZERO_INV', [4, 0])], 'pair': 'thresholdValue4', 'type': 'dropdownpair'}, 'thresholdValue1': {'max': 255, 'min': 0, 'name': 'Red', 'type': 'slider'}, 'thresholdValue2': {'max': 255, 'min': 0, 'name': 'Green', 'type': 'slider'}, 'thresholdValue3': {'max': 255, 'min': 0, 'name': 'Blue', 'type': 'slider'}}#
class npu.lib.applications.videoapps.VideoApplication(filename, videosource=0, pxtype_in=pxtype.RGBA, pxtype_out=pxtype.RGBA)#

Bases: object

Wrapper class that allows to feed and visualize video stream from the NPU

You must pass an xclbin and optionally the pixel type for the input and output images.

Parameters:
  • filename (str) – Path to the xclbin file

  • videosource ([int, str]) – videosource webcam index or path to video file

  • pxtype_in (pxtype) – Pixel type for the input image, either pxtype.RGBA or pxtype.GRAY

  • pxtype_out (pxtype) – Pixel type for the output image, either pxtype.RGBA or pxtype.GRAY

Returns:

Object that abstracts away the video handling from a webcam or video file to visualization

Return type:

VideoApplication

cam_h = None#
cam_w = None#
property resolution#

Webcam video feed resolution

rtps = {}#
start()#

Start the video processing

stop()#

Stop the video processing

property videores#

Video feed resolution to/from the NPU

class npu.lib.applications.videoapps.pxtype(value)#

Bases: Enum

Supported Image types

GRAY = 1#
RGBA = 0#

Module contents#

Applications#

Prebuilt applications can be run as-is with no additional build steps required. The video applications include a variety of computer vision pipelines like color threshold or edge detect.

You can list the available videoapps with

from npu.utils import videoapps videoapps()

Example running edge detect

from npu.lib import EdgeDetectVideoProcessing

app = EdgeDetectVideoProcessing() app.start()