工具/软件:
您好、
SDK 版本:11.00.00.06
我正在创建一个自定义用户内核、其中输入是对象数组、输出是用户数据类型对象。 我在输入中传递对象数组类型、但当图形开始运行时、会显示如下警告:
101.140033 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.174028 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.207621 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.241572 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.275346 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.309431 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.343840 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.381229 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.419198 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.457317 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063 101.479048 s: VX_ZONE_WARNING: [ownNodeUserKernelExecute:1085] node custom_node param index 0 not match, expect type 2067, get 2063
代码片段如下:
内核注册功能 :
/* Kernel registration */
vx_status obj_arr_copy_kernel_register(vx_context context)
{
vxAllocateUserKernelId(context, &g_kernel_id);
vx_kernel kernel = vxAddUserKernel(
context,
(vx_char *)OBJ_ARR_COPY_KERNEL_NAME,
g_kernel_id, // Unique kernel ID
obj_arr_copy_process,
OBJ_ARR_COPY_KERNEL_MAX_PARAMS, // 2 parameters
obj_arr_copy_validate,
NULL, NULL);
if (!kernel)
return VX_ERROR_NO_MEMORY;
/*Add both input and output parameters*/
vxAddParameterToKernel(kernel, OBJ_ARR_COPY_KERNEL_IN_IDX, VX_INPUT, VX_TYPE_OBJECT_ARRAY, VX_PARAMETER_STATE_REQUIRED);
vxAddParameterToKernel(kernel, OBJ_ARR_COPY_KERNEL_OUT_IDX, VX_OUTPUT, VX_TYPE_USER_DATA_OBJECT, VX_PARAMETER_STATE_REQUIRED);
return vxFinalizeKernel(kernel);
}
创建节点:
// API to create a TIOVX graph node for this kernel
vx_node obj_arr_copy_node(vx_graph graph, vx_object_array in, vx_user_data_object out)
{
if (!graph || !in || !out)
{
printf("Invalid input to obj arr copy node creation api\n");
return NULL;
}
vx_reference refs[] = {(vx_reference)in, (vx_reference)out};
vx_node node = tivxCreateNodeByKernelEnum(graph,
g_kernel_id,
refs, sizeof(refs) / sizeof(refs[0]));
if (!node)
return NULL;
return node;
}
调用节点 API:
/*Create custom node*/
custom_obj->node = obj_arr_copy_node(graph, in_arr, custom_obj->output_obj);
if (!custom_obj->node)
{
GEN3_DBG_PRINTF_ERR("Failed to create custom node\n");
}
此处的“in_arr"是“是 VX 对象数组类型。 我已经通过使用 API vxQueryReference () 打印引用类型来进行检查,以获取引用类型,并且它正在打印 enum : 2067(VX 对象数组类型)。
我已将此检查放入内核验证函数、并且也通过了此检查、但当图形开始运行时、内核的进程函数会发出上述警告。 不知道问题在哪里,请建议。
FYI:当前输入对象数组只有一个元素。
谢谢。此致、
Lalit

