def vxMeanStdDevNode_int(graph, input, mean, stddev): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(input) ret2 = defn.verifyScalar(mean) ret3 = defn.verifyScalar(stddev) ret = ret0 & ret1 & ret2 & ret3 if ret is False: logger.error('vxMeanStdDevNode: one or all parameters are wrong') raise AttributeError node = defn.create_dict(defn.VX_NODE,graph) node['VX_DATA'] = VXMeanStdDev(input['VX_DATA'],mean['VX_DATA'],stddev['VX_DATA'],graph['VX_DATA']) if node['VX_DATA'] is None: logger.error('vxMeanStdDevNode: Parameter constraints are not met') raise AttributeError graph['VX_DATA'].node.append(node) return node
def vxSetExtNode_int(graph, inout, value): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(inout) ret2 = defn.verifyScalar(value) ret = ret0 & ret1 & ret2 if ret is not True: logger.error('vxSetExtNode: parameters are wrong ret0 = %s, ret1= %s, ret2 = %s' %(ret0,ret1, ret2)) raise AttributeError return vxArithScalarExtNode(graph, inout, value, inout, OPCODE_ARITH_SET, 0)
def vxMaxScalarExtNode_int(graph, in1, scalarObj, out): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(in1) ret2 = defn.verifyScalar(scalarObj) ret3 = defn.verifyImage(out) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxMaxScalarExtNode: one or all parameters are wrong') raise AttributeError return vxArithScalarExtNode(graph, in1, scalarObj, out, OPCODE_ARITH_MAX, 0)
def vxAddScalarExtNode_int(graph, in1, scalarObj, policy, out): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(in1) ret2 = defn.verifyScalar(scalarObj) ret3 = defn.verifyImage(out) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxAddScalarExtNode: one or all parameters are wrong') raise AttributeError logger.info('vxAddScalarExtNode always uses VX_CONVERT_POLICY_SATURATE policy') return vxArithScalarExtNode(graph, in1, scalarObj, out, OPCODE_ARITH_ADD, 0)
def vxSubtractScalarExtNode_int(graph, in1, scalarObj, policy, out, reverse): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(in1) ret2 = defn.verifyScalar(scalarObj) ret3 = defn.verifyImage(out) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxSubtractScalarExtNode: one or all parameters are wrong') raise AttributeError if ((reverse != 0) and (reverse != 1)): logger.error('vxSubtractScalarExtNode: reverse should be a bool value 1 or 0') raise ValueError logger.info('vxSubtractScalarExtNode: bool argument is %s'%(reverse)) logger.info('vxSubtractScalarExtNode always uses VX_CONVERT_POLICY_SATURATE policy') return vxArithScalarExtNode(graph, in1, scalarObj, out, OPCODE_ARITH_SUB, reverse)
def vxCompareScalarExtNode_int(graph, in1, scalarObj, compare_operation, out): logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(in1) ret2 = defn.verifyScalar(scalarObj) ret3 = defn.verifyImage(out) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxCompareScalarExtNode: one or all parameters are wrong') raise AttributeError if (isinstance(compare_operation,numbers.Number) == False): logger.error('vxCompareScalarExtNode: compare_operation is not a number') raise TypeError if ((compare_operation < brcm_openvx.VX_CMP_EQ) or (compare_operation > brcm_openvx.VX_CMP_NE)): logger.error('vxCompareScalarExtNode: compare operator is wrong') raise ValueError compare_operation = compare_operation - brcm_openvx.VX_CMP_EQ return vxArithScalarExtNode(graph, in1, scalarObj, out, OPCODE_ARITH_CMP, compare_operation)
def vxPedestrianDetectNode_int(graph, image, rectangles, num_rect, scale, levels, quality): #validate parameters logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(image) ret2 = defn.verifyArray(rectangles) ret3 = defn.verifyScalar(num_rect) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxPedestrianDetect: one or all parameters are wrong') raise AttributeError ped_detect = VXPedestrianDetect(graph['VX_DATA'], image['VX_DATA'], rectangles['VX_DATA'], num_rect['VX_DATA'], scale, levels, quality) ped_detect.compute(graph['VX_DATA']) node = defn.create_dict(defn.VX_NODE, graph) node['VX_DATA'] = ped_detect graph['VX_DATA'].node.append(node) return node
def vxFaceDetectNode_int(graph, image, rectangles, num_rect, scale, minSize): #validate parameters logger = logging.getLogger(__name__) ret0 = defn.verifyGraph(graph) ret1 = defn.verifyImage(image) ret2 = defn.verifyArray(rectangles) ret3 = defn.verifyScalar(num_rect) ret = ret0 & ret1 & ret2 & ret3 if ret is not True: logger.error('vxFaceDetect: one or all parameters are wrong') raise AttributeError faceDetect = VXFaceDetect(graph['VX_DATA'], image['VX_DATA'], rectangles['VX_DATA'], num_rect['VX_DATA'], scale, minSize) if faceDetect.compute() == False: logger.error('vxFaceDetect: compute failed') raise ValueError for i in range (faceDetect.resizeCntr): faceDetect.scaleNode[i].compute(graph['VX_DATA']) node = defn.create_dict(defn.VX_NODE,graph) node['VX_DATA'] = faceDetect graph['VX_DATA'].node.append(node) return node