TIOVX User Guide
tiovx.node.Node Class Reference

Node object (OpenVX equivalent = vx_node) More...

Inherits tiovx.reference.Reference.

Inherited by tiovx.node.NodeAbsDiff, tiovx.node.NodeAccumulateImage, tiovx.node.NodeAccumulateSquareImage, tiovx.node.NodeAccumulateWeightedImage, tiovx.node.NodeAdd, tiovx.node.NodeAnd, tiovx.node.NodeBox3x3, tiovx.node.NodeCannyEdgeDetector, tiovx.node.NodeChannelCombine, tiovx.node.NodeChannelExtract, tiovx.node.NodeColorConvert, tiovx.node.NodeConvertDepth, tiovx.node.NodeConvolve, tiovx.node.NodeDilate3x3, tiovx.node.NodeEqualizeHist, tiovx.node.NodeErode3x3, tiovx.node.NodeFastCorners, tiovx.node.NodeGaussian3x3, tiovx.node.NodeGaussianPyramid, tiovx.node.NodeHalfScaleGaussian, tiovx.node.NodeHarrisCorners, tiovx.node.NodeHistogram, tiovx.node.NodeIntegralImage, tiovx.node.NodeLaplacianPyramid, tiovx.node.NodeLaplacianReconstruct, tiovx.node.NodeMagnitude, tiovx.node.NodeMeanStdDev, tiovx.node.NodeMedian3x3, tiovx.node.NodeMinMaxLoc, tiovx.node.NodeMultiply, tiovx.node.NodeNonLinearFilter, tiovx.node.NodeNot, tiovx.node.NodeOpticalFlowPyrLK, tiovx.node.NodeOr, tiovx.node.NodePhase, tiovx.node.NodeRemap, tiovx.node.NodeScaleImage, tiovx.node.NodeSobel3x3, tiovx.node.NodeSubtract, tiovx.node.NodeTableLookup, tiovx.node.NodeThreshold, tiovx.node.NodeWarpAffine, tiovx.node.NodeWarpPerspective, tiovx.node.NodeXor, and vx_tutorial_graph_user_kernel_pytiovx_uc.NodePhaseRgb.

Public Member Functions

def __init__ (self, kernel, args)
 Constructor for base class. More...
 
def checkParams (self, param_type_args)
 Parameter checking function. More...
 
def setParams (self, num_in, num_out, param_type_args)
 Specify number of input/output parameters and data object type for each. More...
 
def setTarget (self, target)
 Specify target on which to run this node. More...
 
def setKernelEnumName (self, kernel_enum_name)
 Specify kernel enum name to use. More...
 

Detailed Description

Node object (OpenVX equivalent = vx_node)

This object is base class for specific nodes which inherit from this class. Some basic checks like parameter matching is done by this class. Inherited node classes can do additional parameter checking.

Node is created by using below syntax.

from tiovx import *
my_node1 = Node<Name>(<data object param>, <data object param>, ..., name="<string>", target=Target.<Target Name>)
# node needs to be added to a graph
my_graph.add(my_node1)
# a more compact way to the same is
my_graph.add( Node<Name>(<data object param>, <data object param>, ..., name="<string>", target=Target.<Target Name>))

Each node can take optional parameter of 'name' and 'target' as input.
'name' is used to given a user readable name to the node which can be seen later in the generated code, image
'target' is used to specify the target on which the node will run when executed. See tiovx.enums.Target for list of supported targets.

Example Usage: Create nodes and add to graph
from tiovx import *
# create a node Sobel3x3 and add to graph object.
# target is specified as DSP1
graph.add ( NodeSobel3x3(in_image, grad_x, grad_y, target=Target.DSP1) )
# create a node Phase and add to graph object.
# target is specified as DSP2
graph.add ( NodePhase(grad_x, grad_y, phase, target=Target.DSP2) )
# create a custom node, as defined in next example and add to graph
graph.add ( NodePhaseRgb(phase, phase_rgb, target=Target.DSP1) )

Users can inherit from Node class to define their own custom nodes.
NOTE: Users need not modify this file to inherit from Node class.
Below code snippet shows one such example

Example Usage: Create custom node class from base class
from tiovx import *
# inherit custom node class from tiobx.node.Node
class NodePhaseRgb (Node) :
# implement constructor
# first list all input and output parameter data objects
# next provide optional parameters of name and target
def __init__(self, image_in, image_out, name="default", target=Target.DEFAULT) :
# call base class constructor with string of kernel name and list of parameters.
# This string of kernel name is later used to create the node
Node.__init__(self, "vx_tutorial_graph.phase_rgb", image_in, image_out)
# Tell base how many of the parameters are input and how many are output
# Also tell the data object type of the parameter
# This is used by base class to do type checking
self.setParams(1, 1, Type.IMAGE, Type.IMAGE)
# Call base class API to set user provided target
self.setTarget(target)
# Tell base class that this is a user kernel and not a OpenVX specified kernel
self.setKernelEnumName("VX_USER_KERNEL")
# implement function to do parameter checking
# if not implemented then base class will do basic parameter checking like type checking
def checkParams(self, *param_type_args) :
# first call base class parameter checker
Node.checkParams(self, *param_type_args)
# Now add additional error conditions over the base class ones
assert ( self.ref[0].width == self.ref[1].width ), "Input and Output width MUST match"
assert ( self.ref[0].height == self.ref[1].height ), "Input and Output height MUST match"
assert ( self.ref[0].df_image == DfImage.U8 ), "Input data format must be U8"
assert ( self.ref[1].df_image == DfImage.RGB ), "Output data format must be RGB"

Given below is the table of built-in kernels within PyTIOVX.

Node class name Parameter data object types (listed in order in which they need to be passed to the Node class constructor)
NodeAbsDiff [in] IMAGE
[in] IMAGE
[out] IMAGE
NodeAccumulateImage [in] IMAGE
[in] IMAGE
[out] IMAGE
NodeAccumulateSquareImage
NodeAccumulateWeightedImage
[in] IMAGE
[in] SCALAR
[in] IMAGE
[out] IMAGE
NodeAdd
NodeSubtract
[in] IMAGE
[in] IMAGE
[in] SCALAR
[out] IMAGE
NodeAnd
NodeXor
NodeOr
[in] IMAGE
[in] IMAGE
[out] IMAGE
NodeNot [in] IMAGE
[out] IMAGE
NodeBox3x3
NodeDilate3x3
NodeErode3x3
NodeGaussian3x3
NodeMedian3x3
[in] IMAGE
[out] IMAGE
NodeCannyEdgeDetector [in] IMAGE
[in] THRESHOLD
[in] SCALAR
[in] SCALAR
[in] IMAGE
NodeChannelCombine [in] IMAGE
[in] IMAGE
[in] IMAGE
[in] IMAGE
[out] IMAGE
NodeChannelExtract [in] IMAGE
[in] SCALAR
[out] IMAGE
NodeColorConvert [in] IMAGE
[out] IMAGE
NodeConvertDepth [in] IMAGE
[out] IMAGE
[in] ENUM
[in] SCALAR
NodeConvolve [in] IMAGE
[in] CONVOLUTION
[out] IMAGE
NodeEqualizeHist [in] IMAGE
[in] IMAGE
NodeFastCorners [in] IMAGE
[in] SCALAR
[in] SCALAR
[out] ARRAY
[out] SCALAR
NodeNonLinearFilter [in] SCALAR
[in] IMAGE
[in] MATRIX
[out] IMAGE
NodeHarrisCorners [in] IMAGE
[in] SCALAR
[in] SCALAR
[in] SCALAR
[in] SCALAR
[in] SCALAR
[out] ARRAY
[out] SCALAR
NodeHistogram [in] IMAGE
[out] DISTRIBUTION
NodeGaussianPyramid [in] IMAGE
[out] PYRAMID
NodeLaplacianPyramid [in] IMAGE
[out] PYRAMID
[out] IMAGE
NodeLaplacianReconstruct [in] PYRAMID
[in] IMAGE
[out] IMAGE
NodeIntegralImage [in] IMAGE
[out] IMAGE
NodeMagnitude
NodePhase
[in] IMAGE
[in] IMAGE
[out] IMAGE
NodeMeanStdDev [in] IMAGE
[out] SCALAR
[out] SCALAR
NodeMinMaxLoc [in] IMAGE
[out] SCALAR
[out] SCALAR
[out] ARRAY
[out] ARRAY
[out] SCALAR
[out] SCALAR
NodeOpticalFlowPyrLK [in] PYRAMID
[in] PYRAMID
[in] ARRAY
[in] ARRAY
[in] SCALAR
[in] SCALAR
[in] SCALAR
[in] SCALAR
[in] SCALAR
[out] ARRAY
NodeMultiply [in] IMAGE
[in] IMAGE
[in] SCALAR
[in] SCALAR
[in] SCALAR
[out] IMAGE
NodeRemap [in] IMAGE
[in] REMAP
[in] SCALAR
[out] IMAGE
NodeScaleImage
NodeHalfScaleGaussian
[in] IMAGE
[out] IMAGE
[in] SCALAR
NodeSobel3x3 [in] IMAGE
[out] IMAGE
[out] IMAGE
NodeTableLookup [in] IMAGE
[in] LUT
[out] IMAGE
NodeThreshold [in] IMAGE
[in] THRESHOLD
[out] IMAGE
NodeWarpAffine
NodeWarpPerspective
[in] IMAGE
[in] MATRIX
[in] SCALAR
[out] IMAGE

Definition at line 290 of file node.py.

Constructor & Destructor Documentation

◆ __init__()

def tiovx.node.Node.__init__ (   self,
  kernel,
  args 
)

Constructor for base class.

Parameters
kernel[in] kernel name of type string. Used to create OpenVX node.
args[in] Variable number of args list of parameter data objects

Definition at line 295 of file node.py.

Member Function Documentation

◆ checkParams()

def tiovx.node.Node.checkParams (   self,
  param_type_args 
)

Parameter checking function.

Checks if number of parameters passed is correct Checks if data type of parameters passed is correct

Parameters
param_type_args[in] Variable number of args list of type tiovx.enums.Type to specify data object types

Definition at line 313 of file node.py.

◆ setParams()

def tiovx.node.Node.setParams (   self,
  num_in,
  num_out,
  param_type_args 
)

Specify number of input/output parameters and data object type for each.

Assumes input parameters are followed by output parameters. It is recommended user kernels follow this convention.

Parameters
num_in[in] Number of inputs
num_out[in] Number of outputs
param_type_args[in] Variable number of args list of type tiovx.enums.Type to specify data object types.
Number of arguments MUST match num_in+num_out

Definition at line 327 of file node.py.

◆ setTarget()

def tiovx.node.Node.setTarget (   self,
  target 
)

Specify target on which to run this node.

Parameters
target[in] Object of type tiovx.enums.Target

Definition at line 339 of file node.py.

◆ setKernelEnumName()

def tiovx.node.Node.setKernelEnumName (   self,
  kernel_enum_name 
)

Specify kernel enum name to use.

Use "VX_USER_KERNEL" as 'kernel_enum_name' for custom/user kernels

Parameters
kernel_enum_name[in] Type string.

Definition at line 354 of file node.py.


The documentation for this class was generated from the following file: