This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Custom Application using OpenVX, Node kernel Validate failed

Hi,

I am using SDK VISION_03_03_00_00. I used your example of vip_single_cam_openvx where I modified your openvx.c  to run vxColorConvertNode,vxChannelExtractNode and vxCannyEdgeDetectorNode. Also I am using Windows OS.

Here is my code.

/******************************************************************************
Copyright (c) [2012 - 2017] Texas Instruments Incorporated

All rights reserved not granted herein.

Limited License.

 Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
 license under copyrights and patents it now or hereafter owns or controls to
 make,  have made, use, import, offer to sell and sell ("Utilize") this software
 subject to the terms herein.  With respect to the foregoing patent license,
 such license is granted  solely to the extent that any such patent is necessary
 to Utilize the software alone.  The patent license shall not apply to any
 combinations which include this software, other than combinations with devices
 manufactured by or for TI ("TI Devices").  No hardware patent is licensed
 hereunder.

 Redistributions must preserve existing copyright notices and reproduce this
 license (including the above copyright notice and the disclaimer and
 (if applicable) source code license limitations below) in the documentation
 and/or other materials provided with the distribution

 Redistribution and use in binary form, without modification, are permitted
 provided that the following conditions are met:

 * No reverse engineering, decompilation, or disassembly of this software
   is permitted with respect to any software provided in binary form.

 * Any redistribution and use are licensed by TI for use only with TI Devices.

 * Nothing shall obligate TI to provide you with source code for the software
   licensed and provided to you in object code.

 If software source code is provided to you, modification and redistribution of
 the source code are permitted provided that the following conditions are met:

 * Any redistribution and use of the source code, including any resulting
   derivative works, are licensed by TI for use only with TI Devices.

 * Any redistribution and use of any object code compiled from the source code
   and any resulting derivative works, are licensed by TI for use only with TI
   Devices.

 Neither the name of Texas Instruments Incorporated nor the names of its
 suppliers may be used to endorse or promote products derived from this software
 without specific prior written permission.

 DISCLAIMER.

 THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL TI AND TI’S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

/**
 *******************************************************************************
 * \file openvx.c
 *
 * \brief  This file implements Actual OpenVX graph processing.
 *         It creates the graph with the single Harris Corners node and
 *         executes the graph for the YUV420 input image.
 *
 * \version 0.0 (March 2017) : [BJ] First version
 *
 *******************************************************************************
*/

/*******************************************************************************
 *  INCLUDE FILES
 *******************************************************************************
 */
#include "openvxLink_priv.h"
#include <include/link_api/system_common.h>
#include <src/rtos/utils_common/include/utils_mem.h>

/* */
#define OPENVX_DRAW_BLOCK_SIZE  (5u)
#define OUT_FILE_NAME   "out.bmp"

/* Create openvx graph and other data objects required for the graph */
Int32 openvxCreate(AlgorithmLink_OpenVxObj *pObj)
{
    Int32 status = SYSTEM_LINK_STATUS_SOK;
    vx_status vxStatus;
    UInt32 cnt;
    AlgorithmLink_OpenVxCreateParams *pCreatePrms;
    AlgorithmLink_GraphObj *gObj;
    System_LinkChInfo *inChInfo;
    AlgorithmLink_OutputObj *outputAddr;

    UTILS_assert(NULL != pObj);
    pCreatePrms = &pObj->createPrms;
    UTILS_assert(NULL != pCreatePrms);

    pObj->context = vxCreateContext();
    if (vxGetStatus((vx_reference)pObj->context) != VX_SUCCESS)
    {
        status = SYSTEM_LINK_STATUS_EFAIL;
    }
    else
    {
        inChInfo = &pObj->inChInfo[0];

        for (cnt = 0u; cnt < pCreatePrms->numOutputFrames; cnt ++)
        {
            gObj = &pObj->graph[cnt];

            memset(gObj, 0, sizeof(AlgorithmLink_GraphObj));

            gObj->graph = vxCreateGraph(pObj->context);
            if (vxGetStatus((vx_reference)gObj->graph) != VX_SUCCESS)
            {
                status = SYSTEM_LINK_STATUS_EFAIL;
                break;
            }

            gObj->input_rgb_image = vxCreateImage(pObj->context, inChInfo->width,
                inChInfo->height, VX_DF_IMAGE_RGB );
            if (vxGetStatus((vx_reference)gObj->input_rgb_image) != VX_SUCCESS)
            {
                status = SYSTEM_LINK_STATUS_EFAIL;                
                break;
            }

           void *inputBuffer = 0;
            if (inputBuffer) {
                    free(inputBuffer);
                    inputBuffer = 0;
                            }
                            
     
     if (!inputBuffer) inputBuffer = calloc(1280*720, sizeof(vx_uint8));

            void*  in_ptrs = gObj->OutputBuffer;
            // gObj->OutputVideoFrameBuffer;   //////////////////////////////
            uint32_t depth = 8;
            uint32_t x  = 1280;
            uint32_t y    = 720;
            int32_t  str_x   =  (depth/8)*sizeof(vx_uint8);
            int32_t  str_y   = x* (depth/8)*sizeof(vx_uint8);
            uint32_t X_scale = VX_SCALE_UNITY;
            uint32_t Y_scale   = VX_SCALE_UNITY; 
            uint32_t X_step     = 1;
            uint32_t Y_step     =1;
            vx_imagepatch_addressing_t  addrs [] = { 
              x,
              y,
              str_x,
              str_y,
              X_scale,
              Y_scale,
              X_step,
              Y_step};
              outputAddr->output_addr = *addrs;
          
            gObj->output_filtered_image = vxCreateImageFromHandle(pObj->context,
                                                                    VX_DF_IMAGE_U8, 
                                                                    addrs, 
                                                                    in_ptrs,
                                                                    //VX_MEMORY_TYPE_NONE);
                                                                    VX_MEMORY_TYPE_HOST);

            if (vxGetStatus((vx_reference)gObj->output_filtered_image) != VX_SUCCESS)
            {
                status = SYSTEM_LINK_STATUS_EFAIL;                
                break;
            }

            gObj->luma_image    = vxCreateVirtualImage(gObj->graph, 1280, 720 , VX_DF_IMAGE_U8 );
                if (vxGetStatus((vx_reference)gObj->luma_image   ) != VX_SUCCESS)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
            
            gObj->yuv_image   = vxCreateVirtualImage(gObj->graph, 1280, 720 , VX_DF_IMAGE_IYUV);
                if (vxGetStatus((vx_reference)gObj->yuv_image  ) != VX_SUCCESS)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }

            
            gObj->hyst = vxCreateThreshold(pObj->context, VX_THRESHOLD_TYPE_RANGE, VX_TYPE_UINT8);
           
           /*NODES*/
            gObj->node=vxColorConvertNode (gObj->graph, gObj->input_rgb_image,gObj->yuv_image); 
            if (vxGetStatus((vx_reference)gObj->node) != VX_SUCCESS )
            {
                status = SYSTEM_LINK_STATUS_EFAIL;
                break;
            }

            gObj->node2 = vxChannelExtractNode (gObj->graph, gObj->yuv_image,VX_CHANNEL_Y,gObj->luma_image); 
             if (vxGetStatus((vx_reference)gObj->node2) != VX_SUCCESS )
            {
                status = SYSTEM_LINK_STATUS_EFAIL;
                break;
            }

            gObj->node3=  vxCannyEdgeDetectorNode(gObj->graph, gObj->luma_image, gObj->hyst, 3, VX_NORM_L1, gObj->output_filtered_image);
            if (vxGetStatus((vx_reference)gObj->node3) != VX_SUCCESS )
            {
                status = SYSTEM_LINK_STATUS_EFAIL;
                break;
            }

            /* Verify the graph */
            vxStatus = vxVerifyGraph(gObj->graph);
            if (VX_SUCCESS != vxStatus)
            {
                status = SYSTEM_LINK_STATUS_EFAIL;
                break;
            }
        }

        if (0 != status)
        {
            openvxDelete(pObj);
        }
        else
        {
            pObj->vxImgAddr.dim_x = inChInfo->width;
            pObj->vxImgAddr.dim_y = inChInfo->height;
            pObj->vxImgAddr.stride_x = 1u;
            pObj->vxImgAddr.stride_y = inChInfo->pitch[0u];
            pObj->vxImgAddr.step_x = 1u;
            pObj->vxImgAddr.step_y = 1u;
        }
    }
    
    return (status);
}


/* Delete OpenVX Graph and other data objects */
Void openvxDelete(AlgorithmLink_OpenVxObj *pObj)
{
    UInt32 cnt;
    AlgorithmLink_OpenVxCreateParams *pCreatePrms;
    AlgorithmLink_GraphObj *gObj;
    void *old_ptr;
    vx_status vxStatus;

    UTILS_assert(NULL != pObj);
    pCreatePrms = &pObj->createPrms;
    UTILS_assert(NULL != pCreatePrms);

    for (cnt = 0u; cnt < pCreatePrms->numOutputFrames; cnt ++)
    {
        gObj = &pObj->graph[cnt];

        if (vxGetStatus((vx_reference)gObj->input_rgb_image) == VX_SUCCESS)
        {
            vxStatus = vxSwapImageHandle(gObj->input_rgb_image, NULL, &old_ptr, 1u);
            UTILS_assert(VX_SUCCESS == vxStatus);   
        }

        if (vxGetStatus((vx_reference)gObj->output_filtered_image) == VX_SUCCESS)
        {
            vxStatus = vxSwapImageHandle(gObj->output_filtered_image, NULL, &old_ptr, 1u);
            UTILS_assert(VX_SUCCESS == vxStatus);           
        }

         if (vxGetStatus((vx_reference)gObj->yuv_image) == VX_SUCCESS)
        {
            vxStatus = vxSwapImageHandle(gObj->yuv_image, NULL, &old_ptr, 1u);
            UTILS_assert(VX_SUCCESS == vxStatus);           
        }

             if (vxGetStatus((vx_reference)gObj->luma_image) == VX_SUCCESS)
        {
            vxStatus = vxSwapImageHandle(gObj->luma_image, NULL, &old_ptr, 1u);
            UTILS_assert(VX_SUCCESS == vxStatus);      
        }


        if (vxGetStatus((vx_reference)gObj->node) == VX_SUCCESS)
        {
            vxReleaseNode(&gObj->node);
        }

        if (vxGetStatus((vx_reference)gObj->node2) == VX_SUCCESS)
        {
            vxReleaseNode(&gObj->node2);
        }
        if (vxGetStatus((vx_reference)gObj->node3) == VX_SUCCESS)
        {
            vxReleaseNode(&gObj->node3);
        }
        if (vxGetStatus((vx_reference)gObj->graph) == VX_SUCCESS)
        {
            vxReleaseGraph(&gObj->graph);
        }
    }

    if (vxGetStatus((vx_reference)pObj->context) == VX_SUCCESS)
    {
        vxReleaseContext(&pObj->context);
    }
}

/* Executes the openvx graph */
Void openvxProcess(AlgorithmLink_OpenVxObj *pObj,
    AlgorithmLink_GraphObj *pGraphObj, System_VideoFrameBuffer *pVidFrm)
{
    vx_status vxStatus;

    UTILS_assert(NULL != pObj);
    UTILS_assert(NULL != pGraphObj);
    UTILS_assert(NULL != pVidFrm);

    /* Use captured image as the source image in the image data object */
    vxStatus = vxSwapImageHandle(pGraphObj->input_rgb_image, &pVidFrm->bufAddr[0],
        NULL, 1u);
    UTILS_assert(VX_SUCCESS == vxStatus);

    /* Process Graph */
    vxStatus = vxProcessGraph(pGraphObj->graph);
    UTILS_assert(VX_SUCCESS == vxStatus);
}

When i  i execute this code  i got message 

 VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
 VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed
 Assertion @ Line: 275 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!
 Assertion @ Line: 275 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!

Can you help me to find what is causing this problem?

Regards,
Luka
  • Hello,

    From your previous question, it looks like the color convert and channel extract node were not giving any further errors, so it appears that the error is now coming from the canny edge node.  Do you mind adding a few logging statements to the canny edge node as described below?  Note, in newer versions of the SDK, we have greatly improved these logging statements, so I would recommend downloading this and at least taking the latest tiovx component.

    In ti_components/open_compute/tiovx_01_07_01_00/kernels/openvx-core/host/vx_canny_host.c, can you add print statements everywhere the status is being updated in the tivxAddKernelCannyValidate function?  You will then need to rebuild tiovx then rebuild your application to take effect.

    Regards,

    Lucas

  • Hi,

    I did what You suggested me, but i did not found error there, actually it change status before it gets to vx_CannyEdgeDetectorNode.

    I looked where it change status to not successful and I found that it happens in vx_graph_verify.c 

    static vx_status ownGraphNodeKernelValidate( vx_graph graph, vx_meta_format meta[])
    {
        vx_node node;
        vx_status status = VX_SUCCESS;
        uint32_t i, j;
        for(i=0; i<graph->num_nodes; i++)
        {
            node = graph->nodes[i];
            status = ownNodeKernelValidate(node, meta);  <<<<--------------- here status changes value
            if(status == VX_SUCCESS)
            {
                status = ownGraphInitVirtualNode(graph, node, meta);
                if(status == VX_SUCCESS)
                { 
                    status = ownGraphValidRectCallback(graph, node, meta);
                }
            }
            if(status != VX_SUCCESS)
            {    
                break;
            }
            for (j = 0; j < TIVX_KERNEL_MAX_PARAMS; j ++)
            {
                meta[j]->valid_rect_callback = NULL;
            }
        }
        return status;
    }
    

    To be more precise in vx_node.c 

    vx_status ownNodeKernelValidate(vx_node node, vx_meta_format meta[])
    {
        vx_status status = VX_SUCCESS;
        uint32_t i;
        uint32_t num_params;
        if((NULL != node) && (NULL != node->kernel))
        {
            if(node->kernel->validate)
            {
                num_params = node->kernel->signature.num_parameters;
                for (i = 0; i < num_params; i ++)
                {
                    meta[i]->type = node->kernel->signature.types[i];
                }
                status = node->kernel->validate(node, node->parameters, num_params, meta);  <<<------------- here status changes value
        }
        else
        {
            status = VX_ERROR_INVALID_PARAMETERS;
    
        }
        return status;
    }

    Regards,

    Luka

  • Hello Luka,

    To clarify, the line you are pointing to is called within a loop that calls the "validate" callback for every node within the graph.  If the error is coming before it hits the canny validate callback then it must be failing within one of the previous nodes' validate callback.

    Can you add similar debug print statements to the tiovx_01_07_01_00/kernels/openvx-core/host/vx_color_convert_host.c and tiovx_01_07_01_00/kernels/openvx-core/host/vx_channel_extract_host.c to help isolate the issue?

    Regards,

    Lucas

  • Hello Lucas,

    I did what You recomended, I printed all statements in vx_color_convert_host.c and vx_channel_extract_host.c but the vx_status has never changed.

    If it helps here is what I get when I  execute code after printing statements:

    CHAINS: Sensor create in progress !!!
    VIDEO_SENSOR: INST0 : I2C0 : I2C Addr = 0x30
    Pred IOCTL_BSP_VID_SENSOR_GET_FEATURES, chanNum: 0
    Pred IOCTL_BSP_VID_SENSOR_GET_CHIP_ID
    VIDEO_SENSOR: VIP 0: DRV ID 1203 (I2C ADDR 0x30): a635:0000:7fa2
    CHAINS: Sensor create ... DONE !!!
    CAPTURE: Create in progress !!!
    CAPTURE: VIP1 Slice1 PortA capture mode is [ 8-bit] !!!
    CAPTURE: Create Done !!!
    ALGORITHM: Create in progress (algId = 10) !!!
    VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed
    ###########STATUS CHANGED openvx.c    f: openvxDelete: if (vxGetStatus((vx_reference)gObj->yuv_image) == VX_SUCCESS)
    ##################### called vxStatus = vxSwapImageHandle
    ###########STATUS CHANGED vx_image.c  f: vxSwapImageHandle :  if (ownIsValidImage(image) == vx_true_e)
    Assertion @ Line: 282 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!
    Assertion @ Line: 282 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!
    NETWORK_CTRL: Starting Server (port=5000) !!!
    NETWORK_CTRL: Starting Server ... DONE (port=5000) !!!

    Assertion @ Line: 282  in openvx/openvx.c is : 

       if (vxGetStatus((vx_reference)gObj->yuv_image) == VX_SUCCESS)
            {
                vxStatus = vxSwapImageHandle(
                                            gObj->yuv_image, 
                                            NULL, 
                                            &old_ptr, 
                                            1u);
    /*282*/     UTILS_assert(VX_SUCCESS == vxStatus);          
            }

    Regards,


    Luka

  • Hello Luka,

    If the vxVerifyGraph call fails, then subsequent calls, such as the vxSwapImageHandle call, will fail too.  Let us first determine what is failing in the vxVerifyGraph call.

    Can you add the following print statement in the ownNodeKernelValidate function before the line listed below?  As you mentioned in your inital query, this is where the first failure occurred, so this print statement will allow us to determine the kernel that is failing.

                printf("kernel name = %s\n", node->kernel->name);

         status = node->kernel->validate(node, node->parameters, num_params, meta);

    Regards,

    Lucas

  • Hello Lucas,

    Here is what I get after printing kernel name:

    .................
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed
    .................


    Regards,

    Luka

  • Hello Luka,

    Based on this, It appears to be failing in the canny edge detector kernel validate callback.  Could you send me the ti_components/open_compute/tiovx_01_07_01_00/kernels/openvx-core/host/vx_canny_host.c file so I can see what print statements you have added previously?

    Can you also print the status immediately after the below call and send me the results?

    status = node->kernel->validate(node, node->parameters, num_params, meta);

    Regards,

    Lucas

  • Hello Lucas,

    I am sorry that I missed to print all sattus in vx_canny_host.c. After I corrected my mistake i found that status changed when it " Check for frame sizes". Here is my code and the status is changes at line 286

    /*
    *
    * Copyright (c) 2017 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    *
    * Limited License.
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
    * license under copyrights and patents it now or hereafter owns or controls to make,
    * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
    * terms herein.  With respect to the foregoing patent license, such license is granted
    * solely to the extent that any such patent is necessary to Utilize the software alone.
    * The patent license shall not apply to any combinations which include this software,
    * other than combinations with devices manufactured by or for TI ("TI Devices").
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license
    * (including the above copyright notice and the disclaimer and (if applicable) source
    * code license limitations below) in the documentation and/or other materials provided
    * with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided
    * that the following conditions are met:
    *
    * *       No reverse engineering, decompilation, or disassembly of this software is
    * permitted with respect to any software provided in binary form.
    *
    * *       any redistribution and use are licensed by TI for use only with TI Devices.
    *
    * *       Nothing shall obligate TI to provide you with source code for the software
    * licensed and provided to you in object code.
    *
    * If software source code is provided to you, modification and redistribution of the
    * source code are permitted provided that the following conditions are met:
    *
    * *       any redistribution and use of the source code, including any resulting derivative
    * works, are licensed by TI for use only with TI Devices.
    *
    * *       any redistribution and use of any object code compiled from the source code
    * and any resulting derivative works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
    *
    * may be used to endorse or promote products derived from this software without
    * specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
    * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
           
    
    
    #include <TI/tivx.h>
    #include <tivx_openvx_core_kernels.h>
    #include <tivx_kernel_canny.h>
    #include <TI/tivx_target_kernel.h>
    
    static vx_kernel vx_canny_ed_kernel = NULL;
    
    static vx_status VX_CALLBACK tivxAddKernelCannyEdValidate(vx_node node,
                const vx_reference parameters[],
                vx_uint32 num,
                vx_meta_format metas[]);
    
    static vx_status VX_CALLBACK tivxAddKernelCannyEdInitialize(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num_params);
    
    static vx_status VX_CALLBACK tivxAddKernelCannyEdValidate(vx_node node,
                const vx_reference parameters[],
                vx_uint32 num,
                vx_meta_format metas[])
    {
        vx_status status = VX_SUCCESS;
        vx_image img[2U];
        vx_uint32 w[2U], h[2U], i;
        vx_df_image fmt[2U];
        vx_threshold thr;
        vx_scalar norm_type, sobel_size;
        vx_border_t border;
    
        for (i = 0U; i < TIVX_KERNEL_CNED_MAX_PARAMS; i ++)
        {
            /* Check for NULL */
            if (NULL == parameters[i])
            {
                status = VX_ERROR_NO_MEMORY;
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 102");
             }
                break;
            }
        }
        if (VX_SUCCESS == status)
        {
            img[0U] = (vx_image)parameters[TIVX_KERNEL_CNED_IN_IMG_IDX];
            img[1U] = (vx_image)parameters[TIVX_KERNEL_CNED_OUT_IMG_IDX];
            thr     = (vx_threshold)parameters[TIVX_KERNEL_CNED_IN_THR_IDX];
            norm_type = (vx_scalar)parameters[TIVX_KERNEL_CNED_IN_SC_NORM_IDX];
            sobel_size = (vx_scalar)parameters[TIVX_KERNEL_CNED_IN_SC_GS_IDX];
    
            /* Get the image width/heigh and format */
            status = vxQueryImage(img[0U], VX_IMAGE_FORMAT, &fmt[0U],
                sizeof(fmt[0U]));
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 120");
             }
    
            status |= vxQueryImage(img[0U], VX_IMAGE_WIDTH, &w[0U], sizeof(w[0U]));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 126");
             }
            status |= vxQueryImage(img[0U], VX_IMAGE_HEIGHT, &h[0U], sizeof(h[0U]));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 131");
             }
        }
    
        if (VX_SUCCESS == status)
        {
            /* Check for validity of data format */
            if (VX_DF_IMAGE_U8 != fmt[0U])
            {
                status = VX_ERROR_INVALID_PARAMETERS;
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 143");
             }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            vx_enum thr_type;
    
            status = vxQueryThreshold(thr, VX_THRESHOLD_DATA_TYPE, &thr_type,
                sizeof(thr_type));
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 156");
             }
    
            if (VX_SUCCESS == status)
            {
                if ((thr_type != VX_TYPE_UINT8) && (VX_TYPE_INT16 != thr_type))
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 166 ");
             }
                }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            vx_enum type;
            vx_int32 value;
    
            status = vxQueryScalar(sobel_size, VX_SCALAR_TYPE, &type, sizeof(type));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 180");
             }
    
            if (VX_SUCCESS == status)
            {
                if (type != VX_TYPE_INT32)
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 190");
             }
                }
                else
                {
                    status = vxCopyScalar(sobel_size, &value, VX_READ_ONLY,
                        VX_MEMORY_TYPE_HOST);
                         if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 199");
             }
    
                    if (VX_SUCCESS == status)
                    {
                        if ((3 != value) && (5 != value) && (7 != value))
                        {
                            status = VX_ERROR_INVALID_PARAMETERS;
                             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 209");
             }
                        }
                    }
                }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            vx_enum type;
            vx_enum value;
    
            status = vxQueryScalar(norm_type, VX_SCALAR_TYPE, &type, sizeof(type));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 225");
             }
    
            if (VX_SUCCESS == status)
            {
                if (type != VX_TYPE_ENUM)
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 235");
             }
                }
                else
                {
                    status = vxCopyScalar(norm_type, &value, VX_READ_ONLY,
                        VX_MEMORY_TYPE_HOST);
                         if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 244");
             }
    
                    if (VX_SUCCESS == status)
                    {
                        if ((VX_NORM_L1 != value) && (VX_NORM_L2 != value))
                        {
                            status = VX_ERROR_INVALID_PARAMETERS;
                             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 254");
             }
                        }
                    }
                }
            }
        }
    
        if ((VX_SUCCESS == status) &&
            (vx_false_e == tivxIsReferenceVirtual((vx_reference)img[1U])))
        {
            /* Get the image width/heigh and format */
            status = vxQueryImage(img[1U], VX_IMAGE_FORMAT, &fmt[1U],
                sizeof(fmt[1U]));
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 270");
             }
            status |= vxQueryImage(img[1U], VX_IMAGE_WIDTH, &w[1U], sizeof(w[1U]));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 275");
             }
            status |= vxQueryImage(img[1U], VX_IMAGE_HEIGHT, &h[1U], sizeof(h[1U]));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 280");
             }
    
            /* Check for frame sizes */
            if ((w[0U] != w[1U]) || (h[0U] != h[1U]))
            {
                status = VX_ERROR_INVALID_PARAMETERS;
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 289");
             }
            }
    
            /* Check for format */
            if (fmt[0U] != fmt[1U])
            {
                status = VX_ERROR_INVALID_PARAMETERS;
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 296");
             }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            status = vxQueryNode(node, VX_NODE_BORDER, &border, sizeof(border));
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 309");
             }
            if (VX_SUCCESS == status)
            {
                if (border.mode != VX_BORDER_UNDEFINED)
                {
                    status = VX_ERROR_NOT_SUPPORTED;
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 318");
             }
                    VX_PRINT(VX_ZONE_ERROR, "Only undefined border mode is supported for canny\n");
                }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            for (i = 0U; i < TIVX_KERNEL_CNED_MAX_PARAMS; i ++)
            {
                if (NULL != metas[i])
                {
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_FORMAT, &fmt[0U],
                        sizeof(fmt[0U]));
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_WIDTH, &w[0U],
                        sizeof(w[0U]));
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_HEIGHT, &h[0U],
                        sizeof(h[0U]));
                }
            }
        }
        return status;
    }
    
    static vx_status VX_CALLBACK tivxAddKernelCannyEdInitialize(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num_params)
    {
        vx_status status = VX_SUCCESS;
        vx_uint32 i;
        tivxKernelValidRectParams prms;
        vx_scalar sobel_size;
        vx_int32 value;
    
        if (num_params != TIVX_KERNEL_CNED_MAX_PARAMS)
        {
            status = VX_ERROR_INVALID_PARAMETERS;
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 358");
             }
        }
    
        for (i = 0U; (i < TIVX_KERNEL_CNED_MAX_PARAMS) &&
                (VX_SUCCESS == status); i ++)
        {
            /* Check for NULL */
            if (NULL == parameters[i])
            {
                status = VX_ERROR_NO_MEMORY;
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 371");
             }
                break;
            }
        }
    
        if (VX_SUCCESS == status)
        {
            tivxKernelValidRectParams_init(&prms);
    
            prms.in_img[0] = (vx_image)parameters[TIVX_KERNEL_CNED_IN_IMG_IDX];
            prms.out_img[0] = (vx_image)parameters[TIVX_KERNEL_CNED_OUT_IMG_IDX];
    
            sobel_size = (vx_scalar)parameters[TIVX_KERNEL_CNED_IN_SC_GS_IDX];
    
            status = vxCopyScalar(sobel_size, &value, VX_READ_ONLY, VX_MEMORY_TYPE_HOST);
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 389");
             }
    
            prms.num_input_images = 1;
            prms.num_output_images = 1;
    
            prms.top_pad = ((value-1)/2) + 1;
            prms.bot_pad = ((value-1)/2) + 1;
            prms.left_pad = ((value-1)/2) + 1;
            prms.right_pad = ((value-1)/2) + 1;
            prms.border_mode = VX_BORDER_UNDEFINED;
    
            status = tivxKernelConfigValidRect(&prms);
             if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 404");
             }
        }
    
        return status;
    }
    
    vx_status tivxAddKernelCannyEd(vx_context context)
    {
        vx_kernel kernel;
        vx_status status;
        uint32_t index;
    
        kernel = vxAddUserKernel(
                                context,
                                "org.khronos.openvx.canny_edge_detector",
                                VX_KERNEL_CANNY_EDGE_DETECTOR,
                                NULL,
                                TIVX_KERNEL_CNED_MAX_PARAMS,
                                tivxAddKernelCannyEdValidate,
                                tivxAddKernelCannyEdInitialize,
                                NULL);
    
        status = vxGetStatus((vx_reference)kernel);
         if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 430");
             }
    
        if ( status == VX_SUCCESS)
        {
            index = 0;
    
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_INPUT,
                    VX_TYPE_IMAGE,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 447");
             }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_INPUT,
                    VX_TYPE_THRESHOLD,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 461");
             }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_INPUT,
                    VX_TYPE_SCALAR,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 475");
             }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_INPUT,
                    VX_TYPE_SCALAR,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 489");
             }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_OUTPUT,
                    VX_TYPE_IMAGE,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                     if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 503");
             }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                /* add supported target's */
                tivxAddKernelTarget(kernel, TIVX_TARGET_DSP1);
                tivxAddKernelTarget(kernel, TIVX_TARGET_DSP2);
            }
    
            if ( status == VX_SUCCESS)
            {
                status = vxFinalizeKernel(kernel);
                 if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 519");
             }
            }
            if( status != VX_SUCCESS)
            {
                vxReleaseKernel(&kernel);
                kernel = NULL;
            }
        }
        else
        {
            kernel = NULL;
        }
    
        vx_canny_ed_kernel = kernel;
    
        return status;
    }
    
    vx_status tivxRemoveKernelCannyEd(vx_context context)
    {
        vx_status status;
        vx_kernel kernel = vx_canny_ed_kernel;
    
        /* Kernel is released as part of Remove Kernel */
        status = vxRemoveKernel(kernel);
         if (status != VX_SUCCESS )  
             {
                 Vps_printf("vx_canny_host.c line 547");
             }
    
        vx_canny_ed_kernel = NULL;
    
        return status;
    }
    
    
    
    
    
    

    Also I printed  status as You asked me and here is result:

    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    vx_canny_host.c line 289
    STATUS CHANGED AFTER status = node->kernel->validate(node, node->parameters, num_params, meta);
    VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed

    Regards,

    Luk

  • Hello Luka,

    In the vx_canny_host.c, can you print out the w[0u], w[1u], h[0], and h[1u] values on line 289 to see which ones are mismatching?

    Regards,

    Lucas

  • Hello Lucas,

    Here are results:

    
    
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    w[0U] = 1280
    w[1U] = 1280
    h[0U] = 720
    h[1U] = 720
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    w[0U] = 1
    w[1U] = 1280
    h[0U] = 1
    h[1U] = 720
    vx_canny_host.c line 289
    STATUS CHANGED AFTER status = node->kernel->validate(node, node->parameters, num_params, meta);
    VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed

    Regards,

    Luka

  • Hello Luka,

    Can you try modifying the two virtual images in your application to normal images?  You will need to change the API from vxCreateVirtualImage to vxCreateImage.  Given that this is an older release, the virtual image with canny may not have been tested sufficiently and is therefore causing the failure.

    Note: you will receive the same performance with virtual image as with the normal image.

    Regards,

    Lucas

  • Hello  Lucas,

    After I changed vxCreateVirtualImage  to  vxCreateImage i got other errors in vx_color_convert_host.c 

    Here is my code 

    /*
    *
    * Copyright (c) 2017 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    *
    * Limited License.
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
    * license under copyrights and patents it now or hereafter owns or controls to make,
    * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
    * terms herein.  With respect to the foregoing patent license, such license is granted
    * solely to the extent that any such patent is necessary to Utilize the software alone.
    * The patent license shall not apply to any combinations which include this software,
    * other than combinations with devices manufactured by or for TI ("TI Devices").
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license
    * (including the above copyright notice and the disclaimer and (if applicable) source
    * code license limitations below) in the documentation and/or other materials provided
    * with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided
    * that the following conditions are met:
    *
    * *       No reverse engineering, decompilation, or disassembly of this software is
    * permitted with respect to any software provided in binary form.
    *
    * *       any redistribution and use are licensed by TI for use only with TI Devices.
    *
    * *       Nothing shall obligate TI to provide you with source code for the software
    * licensed and provided to you in object code.
    *
    * If software source code is provided to you, modification and redistribution of the
    * source code are permitted provided that the following conditions are met:
    *
    * *       any redistribution and use of the source code, including any resulting derivative
    * works, are licensed by TI for use only with TI Devices.
    *
    * *       any redistribution and use of any object code compiled from the source code
    * and any resulting derivative works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
    *
    * may be used to endorse or promote products derived from this software without
    * specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
    * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
    
    
    
    #include <TI/tivx.h>
    #include <tivx_openvx_core_kernels.h>
    #include <tivx_kernel_color_convert.h>
    #include <TI/tivx_target_kernel.h>
    
    
    static vx_kernel vx_color_convert_kernel = NULL;
    
    static vx_status tivxCheckFormatAndPlanes(vx_size plane, vx_df_image format);
    
    static vx_status VX_CALLBACK tivxAddKernelColorConvertValidate(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num,
                vx_meta_format metas[]);
    
    static vx_status VX_CALLBACK tivxAddKernelColorConvertInitialize(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num_params);
    
    static vx_status tivxCheckFormatAndPlanes(vx_size plane, vx_df_image format)
    {
        vx_status status = VX_ERROR_INVALID_PARAMETERS;
    
        switch(plane)
        {
            case 1:
            {
                switch (format)
                {
                    case VX_DF_IMAGE_RGB:
                    case VX_DF_IMAGE_RGBX:
                    case VX_DF_IMAGE_UYVY:
                    case VX_DF_IMAGE_YUYV:
                        status = VX_SUCCESS;
                        break;
                    default:
                        break;
                }
                break;
            }
            case 2:
            {
                switch (format)
                {
                    case VX_DF_IMAGE_NV12:
                    case VX_DF_IMAGE_NV21:
                        status = VX_SUCCESS;
                        break;
                    default:
                        break;
                }
                break;
            }
            case 3:
            {
                switch (format)
                {
                    case VX_DF_IMAGE_IYUV:
                    case VX_DF_IMAGE_YUV4:
                        status = VX_SUCCESS;
                        break;
                    default:
                        break;
                }
                break;
            }
            default:
                break;
        }
    
        return status;
    }
    
    static vx_status VX_CALLBACK tivxAddKernelColorConvertValidate(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num,
                vx_meta_format metas[])
    {
        vx_status status = VX_SUCCESS;
        vx_image img[2U];
        vx_df_image out_fmt;
        vx_uint32 i, w[2U], h[2U];
        vx_df_image src_format, dst_format;
        vx_size src_planes, dst_planes;
        vx_enum src_space;
        vx_rectangle_t rect;
    
        for (i = 0U; i < TIVX_KERNEL_COLOR_CONVERT_MAX_PARAMS; i++)
        {
            /* Check for NULL */
            if (NULL == parameters[i])
            {
                status = VX_ERROR_NO_MEMORY;
                if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS2");
    }
                break;
            }
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS3");
    }
        }
    
        if (VX_SUCCESS == status)
        {
            img[0U] = (vx_image)parameters[TIVX_KERNEL_COLOR_CONVERT_IN_IMG_IDX];
            img[1U] = (vx_image)parameters[TIVX_KERNEL_COLOR_CONVERT_OUT_IMG_IDX];
    
            status |= vxQueryImage(img[0U], VX_IMAGE_FORMAT, &src_format, sizeof(src_format));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS4");
    }
            status |= vxQueryImage(img[0U], VX_IMAGE_SPACE, &src_space, sizeof(src_space));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS5");
    }
            status |= vxQueryImage(img[0U], VX_IMAGE_PLANES, &src_planes, sizeof(src_planes));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS6");
    }
    
            status |= vxQueryImage(img[0U], VX_IMAGE_WIDTH, &w[0U], sizeof(w[0U]));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS7");
    }
            status |= vxQueryImage(img[0U], VX_IMAGE_HEIGHT, &h[0U], sizeof(h[0U]));
    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS8");
    }
            status |= vxGetValidRegionImage(img[0U], &rect);
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS9");
    }
    
            if (VX_SUCCESS == status)
            {
                status = tivxCheckFormatAndPlanes(src_planes, src_format);
                if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS10");
    }
            }
            dst_format = src_format;
        }
    
        if (VX_SUCCESS == status)
        {
            status |= vxQueryImage(img[1U], VX_IMAGE_FORMAT, &dst_format, sizeof(dst_format));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS11");
    }
            status |= vxQueryImage(img[1U], VX_IMAGE_PLANES, &dst_planes, sizeof(dst_planes));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS12");
    }
    
            status |= vxQueryImage(img[1U], VX_IMAGE_WIDTH, &w[1U], sizeof(w[1U]));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS13");
    }
            status |= vxQueryImage(img[1U], VX_IMAGE_HEIGHT, &h[1U], sizeof(h[1U]));
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS14");
    }
    
            if (VX_SUCCESS == status)
            {
                if(src_format == dst_format)
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS15");
    }
                }
            }
        }
    
        if ((VX_SUCCESS == status) &&
            (vx_false_e == tivxIsReferenceVirtual((vx_reference)img[1U])))
        {
            if (VX_SUCCESS == status)
            {
                /* Verifies luma channel size */
                if ((w[0U] != w[1U]) || (h[0U] != h[1U]))
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS16");
    }
                }
    
                if(src_format == dst_format)
                {
                    status = VX_ERROR_INVALID_PARAMETERS;
                    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS17");
    }
                }
            }
    
            if (VX_SUCCESS == status)
            {
                status = tivxCheckFormatAndPlanes(dst_planes, dst_format);
                if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS18");
    }
            }
        }
    
        if (VX_SUCCESS == status)
        {
            out_fmt = dst_format;
            for (i = 0U; i < TIVX_KERNEL_COLOR_CONVERT_MAX_PARAMS; i ++)
            {
                if (NULL != metas[i])
                {
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_FORMAT, &out_fmt,
                        sizeof(out_fmt));
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_WIDTH, &w[0U],
                        sizeof(w[0U]));
                    vxSetMetaFormatAttribute(metas[i], VX_IMAGE_HEIGHT, &h[0U],
                        sizeof(h[0U]));
                }
            }
        }
        if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS19");
    }
        return status;
    }
    
    static vx_status VX_CALLBACK tivxAddKernelColorConvertInitialize(vx_node node,
                const vx_reference parameters[ ],
                vx_uint32 num_params)
    {
        vx_status status = VX_SUCCESS;
        tivxKernelValidRectParams prms;
    
        if ((num_params != TIVX_KERNEL_COLOR_CONVERT_MAX_PARAMS)
            || (NULL == parameters[TIVX_KERNEL_COLOR_CONVERT_IN_IMG_IDX])
            || (NULL == parameters[TIVX_KERNEL_COLOR_CONVERT_OUT_IMG_IDX]))
        {
            status = VX_ERROR_INVALID_PARAMETERS;
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS20");
    }
        }
    
        if (VX_SUCCESS == status)
        {
            tivxKernelValidRectParams_init(&prms);
    
            prms.in_img[0] = (vx_image)parameters[TIVX_KERNEL_COLOR_CONVERT_IN_IMG_IDX];
            prms.out_img[0] = (vx_image)parameters[TIVX_KERNEL_COLOR_CONVERT_OUT_IMG_IDX];
    
            prms.num_input_images = 1;
            prms.num_output_images = 1;
    
            prms.top_pad = 0;
            prms.bot_pad = 0;
            prms.left_pad = 0;
            prms.right_pad = 0;
            prms.border_mode = VX_BORDER_UNDEFINED;
    
            status = tivxKernelConfigValidRect(&prms);
            if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS21");
    }
        }
    
        return status;
    }
    
    
    vx_status tivxAddKernelColorConvert(vx_context context)
    {
        vx_kernel kernel;
        vx_status status;
        uint32_t index;
    
        kernel = vxAddUserKernel(
                                context,
                                "org.khronos.openvx.color_convert",
                                VX_KERNEL_COLOR_CONVERT,
                                NULL,
                                2,
                                tivxAddKernelColorConvertValidate,
                                tivxAddKernelColorConvertInitialize,
                                NULL);
    
        status = vxGetStatus((vx_reference)kernel);
        if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS22");
    }
    
        if ( status == VX_SUCCESS)
        {
            index = 0;
    
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_INPUT,
                    VX_TYPE_IMAGE,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS23");
    }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                status = vxAddParameterToKernel(kernel,
                    index,
                    VX_OUTPUT,
                    VX_TYPE_IMAGE,
                    VX_PARAMETER_STATE_REQUIRED
                    );
                    if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS24");
    }
                index++;
            }
            if ( status == VX_SUCCESS)
            {
                /* add supported target's */
                tivxAddKernelTarget(kernel, TIVX_TARGET_DSP1);
                tivxAddKernelTarget(kernel, TIVX_TARGET_DSP2);
            }
    
            if ( status == VX_SUCCESS)
            {
                status = vxFinalizeKernel(kernel);
                if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS25");
    }
            }
            if( status != VX_SUCCESS)
            {
                vxReleaseKernel(&kernel);
                kernel = NULL;
            }
        }
        else
        {
            kernel = NULL;
        }
    
        vx_color_convert_kernel = kernel;
    
        return status;
    }
    
    vx_status tivxRemoveKernelColorConvert(vx_context context)
    {
        vx_status status;
        vx_kernel kernel = vx_color_convert_kernel;
    
        /* Kernel is released as part of Remove Kernel */
        status = vxRemoveKernel(kernel);
        if (status!=VX_SUCCESS)  
             { Vps_printf("vx_color_convert_host STATUS26");
    }
    
        vx_color_convert_kernel = NULL;
    
        return status;
    }
    
    
    

    And here is what I got when I execute it:

    ...........................................
    kernel name = org.khronos.openvx.color_convert
    kernel name = org.khronos.openvx.channel_extract
    kernel name = org.khronos.openvx.canny_edge_detector
    w[0U] = 1280
    w[1U] = 1280
    h[0U] = 720
    h[1U] = 720
    kernel name = org.khronos.openvx.color_convert
    vx_color_convert_host STATUS 16
    vx_color_convert_host STATUS 19
    STATUS IS CHANGED AFTER status = node->kernel->validate(node, node->parameters, num_params, meta);
    VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed
    Assertion @ Line: 285 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!
    Assertion @ Line: 285 in openvx/openvx.c: VX_SUCCESS == vxStatus : failed !!!

    Regards,

    Luka

  • Hello Luka,

    Could you please send me your updated application code?

    Also, could you please print the w[0], h[0], w[1] and h[1] where you have status 16 in the color convert host and send the results?

    Regards,

    Lucas

  • Hello Lucas,

    Here is my application code: 

    /******************************************************************************
    Copyright (c) [2012 - 2017] Texas Instruments Incorporated
    
    All rights reserved not granted herein.
    
    Limited License.
    
     Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
     license under copyrights and patents it now or hereafter owns or controls to
     make,  have made, use, import, offer to sell and sell ("Utilize") this software
     subject to the terms herein.  With respect to the foregoing patent license,
     such license is granted  solely to the extent that any such patent is necessary
     to Utilize the software alone.  The patent license shall not apply to any
     combinations which include this software, other than combinations with devices
     manufactured by or for TI ("TI Devices").  No hardware patent is licensed
     hereunder.
    
     Redistributions must preserve existing copyright notices and reproduce this
     license (including the above copyright notice and the disclaimer and
     (if applicable) source code license limitations below) in the documentation
     and/or other materials provided with the distribution
    
     Redistribution and use in binary form, without modification, are permitted
     provided that the following conditions are met:
    
     * No reverse engineering, decompilation, or disassembly of this software
       is permitted with respect to any software provided in binary form.
    
     * Any redistribution and use are licensed by TI for use only with TI Devices.
    
     * Nothing shall obligate TI to provide you with source code for the software
       licensed and provided to you in object code.
    
     If software source code is provided to you, modification and redistribution of
     the source code are permitted provided that the following conditions are met:
    
     * Any redistribution and use of the source code, including any resulting
       derivative works, are licensed by TI for use only with TI Devices.
    
     * Any redistribution and use of any object code compiled from the source code
       and any resulting derivative works, are licensed by TI for use only with TI
       Devices.
    
     Neither the name of Texas Instruments Incorporated nor the names of its
     suppliers may be used to endorse or promote products derived from this software
     without specific prior written permission.
    
     DISCLAIMER.
    
     THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     IN NO EVENT SHALL TI AND TI’S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    ******************************************************************************/
    
    /**
     *******************************************************************************
     * \file openvx.c
     *
     * \brief  This file implements Actual OpenVX graph processing.
     *         It creates the graph with the single Harris Corners node and
     *         executes the graph for the YUV420 input image.
     *
     * \version 0.0 (March 2017) : [BJ] First version
     *
     *******************************************************************************
    */
    
    /*******************************************************************************
     *  INCLUDE FILES
     *******************************************************************************
     */
    #include "openvxLink_priv.h"
    #include <include/link_api/system_common.h>
    #include <src/rtos/utils_common/include/utils_mem.h>
    
    /* */
    #define OPENVX_DRAW_BLOCK_SIZE  (5u)
    #define OUT_FILE_NAME   "out.bmp"
    
    /* Create openvx graph and other data objects required for the graph */
    Int32 openvxCreate(AlgorithmLink_OpenVxObj *pObj)
    {
        Int32 status = SYSTEM_LINK_STATUS_SOK;
        vx_status vxStatus;
        UInt32 cnt;
        AlgorithmLink_OpenVxCreateParams *pCreatePrms;
        AlgorithmLink_GraphObj *gObj;
        System_LinkChInfo *inChInfo;
        AlgorithmLink_OutputObj *outputAddr;
    
        UTILS_assert(NULL != pObj);
        pCreatePrms = &pObj->createPrms;
        UTILS_assert(NULL != pCreatePrms);
    
        pObj->context = vxCreateContext();
        if (vxGetStatus((vx_reference)pObj->context) != VX_SUCCESS)
        {
            status = SYSTEM_LINK_STATUS_EFAIL;
        }
        else
        {
            inChInfo = &pObj->inChInfo[0];
    
            for (cnt = 0u; cnt < pCreatePrms->numOutputFrames; cnt ++)
            {
                gObj = &pObj->graph[cnt];
    
                memset(gObj, 0, sizeof(AlgorithmLink_GraphObj));
    
                gObj->graph = vxCreateGraph(pObj->context);
                if (vxGetStatus((vx_reference)gObj->graph) != VX_SUCCESS)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
    
                gObj->input_rgb_image = vxCreateImage(pObj->context, inChInfo->width,
                    inChInfo->height, VX_DF_IMAGE_RGB );
                if (vxGetStatus((vx_reference)gObj->input_rgb_image) != VX_SUCCESS)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;                
                    break;
                }
    
    
                void*  in_ptrs = gObj->OutputVideoFrameBuffer;
                uint32_t depth = 8;
                uint32_t x  = 1280;
                uint32_t y    = 720;
                int32_t  str_x   =  (depth/8)*sizeof(vx_uint8);
                int32_t  str_y   = x* (depth/8)*sizeof(vx_uint8);
                uint32_t X_scale = VX_SCALE_UNITY;
                uint32_t Y_scale   = VX_SCALE_UNITY; 
                uint32_t X_step     = 1;
                uint32_t Y_step     =1;
                vx_imagepatch_addressing_t  addrs [] = { 
                  x,
                  y,
                  str_x,
                  str_y,
                  X_scale,
                  Y_scale,
                  X_step,
                  Y_step};
    
                outputAddr->output_addr = *addrs;
              
                gObj->output_filtered_image = vxCreateImageFromHandle(pObj->context,
                                                                        VX_DF_IMAGE_U8, 
                                                                        addrs, 
                                                                        in_ptrs,
                                                                        VX_MEMORY_TYPE_HOST);
    
                if (vxGetStatus((vx_reference)gObj->output_filtered_image) != VX_SUCCESS)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;                
                    break;
                }
    
    
                gObj->yuv_image   =  vxCreateImage(pObj->context, 1280, 720, VX_DF_IMAGE_IYUV );
                if (vxGetStatus((vx_reference)gObj->yuv_image  ) != VX_SUCCESS)
                    {
                        status = SYSTEM_LINK_STATUS_EFAIL;
                        break;
                    }
    
    
                gObj->luma_image    = vxCreateImage(pObj->context, 1280, 720, VX_DF_IMAGE_U8 );
                if (vxGetStatus((vx_reference)gObj->luma_image   ) != VX_SUCCESS)
                    {
                        status = SYSTEM_LINK_STATUS_EFAIL;
                        break;
                    }
                
                gObj->hyst = vxCreateThreshold(pObj->context, VX_THRESHOLD_TYPE_RANGE, VX_TYPE_UINT8);
               
               /*NODES*/
                gObj->node=vxColorConvertNode (gObj->graph, gObj->input_rgb_image,gObj->yuv_image); 
                if (vxGetStatus((vx_reference)gObj->node) != VX_SUCCESS )
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
    
                gObj->node2 = vxChannelExtractNode (gObj->graph, gObj->yuv_image,VX_CHANNEL_Y,gObj->luma_image); 
                 if (vxGetStatus((vx_reference)gObj->node2) != VX_SUCCESS )
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
    
                gObj->node3=  vxCannyEdgeDetectorNode(gObj->graph, gObj->luma_image, gObj->hyst, 3, VX_NORM_L1, gObj->output_filtered_image);
                if (vxGetStatus((vx_reference)gObj->node3) != VX_SUCCESS )
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
    
                /* Verify the graph */
                vxStatus = vxVerifyGraph(gObj->graph);
                if (VX_SUCCESS != vxStatus)
                {
                    status = SYSTEM_LINK_STATUS_EFAIL;
                    break;
                }
            }
    
            if (0 != status)
            {
                openvxDelete(pObj);
            }
            else
            {
                pObj->vxImgAddr.dim_x = inChInfo->width;
                pObj->vxImgAddr.dim_y = inChInfo->height;
                pObj->vxImgAddr.stride_x = 1u;
                pObj->vxImgAddr.stride_y = inChInfo->pitch[0u];
                pObj->vxImgAddr.step_x = 1u;
                pObj->vxImgAddr.step_y = 1u;
            }
        }
        
        return (status);
    }
    
    
    /* Delete OpenVX Graph and other data objects */
    Void openvxDelete(AlgorithmLink_OpenVxObj *pObj)
    {
        UInt32 cnt;
        AlgorithmLink_OpenVxCreateParams *pCreatePrms;
        AlgorithmLink_GraphObj *gObj;
        void *old_ptr;
        vx_status vxStatus;
    
        UTILS_assert(NULL != pObj);
        pCreatePrms = &pObj->createPrms;
        UTILS_assert(NULL != pCreatePrms);
    
        for (cnt = 0u; cnt < pCreatePrms->numOutputFrames; cnt ++)
        {
            gObj = &pObj->graph[cnt];
    
            if (vxGetStatus((vx_reference)gObj->input_rgb_image) == VX_SUCCESS)
            {
                vxStatus = vxSwapImageHandle(gObj->input_rgb_image, NULL, &old_ptr, 1u);
                UTILS_assert(VX_SUCCESS == vxStatus);   
            }
    
            if (vxGetStatus((vx_reference)gObj->output_filtered_image) == VX_SUCCESS)
            {
                vxStatus = vxSwapImageHandle(gObj->output_filtered_image, NULL, &old_ptr, 1u);
                UTILS_assert(VX_SUCCESS == vxStatus);           
            }
    
             if (vxGetStatus((vx_reference)gObj->yuv_image) == VX_SUCCESS)
            {
                vxStatus = vxSwapImageHandle(
                                            gObj->yuv_image, 
                                            NULL, 
                                            &old_ptr, 
                                            1u);
                UTILS_assert(VX_SUCCESS == vxStatus); 
            }
    
                 if (vxGetStatus((vx_reference)gObj->luma_image) == VX_SUCCESS)
            {
                vxStatus = vxSwapImageHandle(gObj->luma_image, NULL, &old_ptr, 1u);
                UTILS_assert(VX_SUCCESS == vxStatus);      
            }
    
    
            if (vxGetStatus((vx_reference)gObj->node) == VX_SUCCESS)
            {
                vxReleaseNode(&gObj->node);
            }
    
            if (vxGetStatus((vx_reference)gObj->node2) == VX_SUCCESS)
            {
                vxReleaseNode(&gObj->node2);
            }
            if (vxGetStatus((vx_reference)gObj->node3) == VX_SUCCESS)
            {
                vxReleaseNode(&gObj->node3);
            }
            if (vxGetStatus((vx_reference)gObj->graph) == VX_SUCCESS)
            {
                vxReleaseGraph(&gObj->graph);
            }
        }
    
        if (vxGetStatus((vx_reference)pObj->context) == VX_SUCCESS)
        {
            vxReleaseContext(&pObj->context);
        }
    }
    
    /* Executes the openvx graph */
    Void openvxProcess(AlgorithmLink_OpenVxObj *pObj,
        AlgorithmLink_GraphObj *pGraphObj, System_VideoFrameBuffer *pVidFrm)
    {
        vx_status vxStatus;
    
        UTILS_assert(NULL != pObj);
        UTILS_assert(NULL != pGraphObj);
        UTILS_assert(NULL != pVidFrm);
    
        /* Use captured image as the source image in the image data object */
        vxStatus = vxSwapImageHandle(pGraphObj->input_rgb_image, &pVidFrm->bufAddr[0],
            NULL, 1u);
        UTILS_assert(VX_SUCCESS == vxStatus);
    
        /* Process Graph */
        vxStatus = vxProcessGraph(pGraphObj->graph);
        UTILS_assert(VX_SUCCESS == vxStatus);
    }
    

    After printing w and h in vx_color_convert_host my output is:

    ..................................................
    [IPU1-0]     10.381565 s: kernel name = org.khronos.openvx.color_convert
    [IPU1-0]     10.381717 s: vx_color_convert_host w[0U] = 1280
    [IPU1-0]     10.381778 s: vx_color_convert_host w[1U] = 1280
    [IPU1-0]     10.381870 s: vx_color_convert_host h[0U] = 720
    [IPU1-0]     10.381931 s: vx_color_convert_host h[1U] = 720
    [IPU1-0]     10.382022 s: kernel name = org.khronos.openvx.channel_extract
    [IPU1-0]     10.382175 s: kernel name = org.khronos.openvx.canny_edge_detector
    [IPU1-0]     10.382297 s: vx_canny_host w[0U] = 1280
    [IPU1-0]     10.382358 s: vx_canny_host w[1U] = 1280
    [IPU1-0]     10.382419 s: vx_canny_host h[0U] = 720
    [IPU1-0]     10.382510 s: vx_canny_host h[1U] = 720
    [IPU1-0]     10.476514 s: kernel name = org.khronos.openvx.color_convert
    [IPU1-0]     10.476636 s: vx_color_convert_host w[0U] = 1
    [IPU1-0]     10.476727 s: vx_color_convert_host w[1U] = 1280
    [IPU1-0]     10.476788 s: vx_color_convert_host h[0U] = 1
    [IPU1-0]     10.476849 s: vx_color_convert_host h[1U] = 720
    [IPU1-0]     10.476941 s: vx_color_convert_host STATUS16
    [IPU1-0]     10.477002 s: vx_color_convert_host STATUS19
    [IPU1-0]     10.477063 s: STATUS IS CHANGED AFTER status = node->kernel->validate(node, node->parameters, num_params, meta);
    [IPU1-0]     10.477459 s:  VX_ZONE_ERROR:[vxVerifyGraph:682] Node kernel Validate failed
    [IPU1-0]     10.477703 s:  VX_ZONE_ERROR:[vxVerifyGraph:766] Graph verify failed

    Regards,

    Luka

  • Hello Luka,

    Where are the values inChInfo->width and inChInfo->height coming from?  Can you print these values?  It looks like the input image to the color convert (gObj->input_rgb_image) is using these values to create the image.  Depending on what these inChInfo values are supposed to be, you may need to use 1280 and 720 to create gObj->input_rgb_image.

    Regards,

    Lucas

  • Hello Lucas,

    inChInfo->width and inChInfo->height are 1280 and 720. When I put 1280 and 720 instead of inChInfo->width and inChInfo->height my code runs but my output is now a black screen. 

    Regards,

    Luka

  • Hello Luka,

    Could you provide more information about your entire use case?  Which image are you trying to display?  Can you write any of the intermediate images to a file to help debug what the issue could be?

    Regards,
    Lucas

  • Hello Lucas,

    I am using ALPHA AMV board. I am trying to recognize specific shape (for example rectangle) using openvx. My input image comes from camera.
    Here are my alg_plugin and usecase

    openvx_project.zip

    Regards,
    Luka

  • Hello Luka,

    I compared the openvx.c and openvx_algPlugin.c to the original files included within the 3.03 VSDK release.  These have had several changes, so it is difficult to tell what should be occurring in the new use case.

    You may already be aware, but the OpenVX alg plugin in the original use case took in the input image from the camera and performed a corner detection algorithm.  It then extracted the corners and drew these corners onto the camera image before sending it to display.  Are you trying to do some similar?

    Also, I did notice that the input image to your OpenVX graph is now an RGB image rather than a U8 image as before.  Depending on what sensor you are using, this could potentially be an issue.

    Is there a way that you can incrementally add the nodes back in to the graph and see which node is the cause of the issue you are seeing?  In addition, you could potentially write the intermediate images to file to see if the intermediate outputs are what you expect.

    Regards,

    Lucas