Converting nvxcu_array to vx_array and access its items.

I am trying to access detected features in nvxcu based feature detector sample. How to directly access the nvxcu array items and how can i convert it to vx_array and access them.


You can find some sample in our ‘feature_tracker_nvxcu’ sample:

nvxcu_plain_array_t createArrayPoint2F(uint32_t capacity)
    void * dev_ptr = NULL;
    CUDA_SAFE_CALL( cudaMalloc(&dev_ptr, capacity * sizeof(nvxcu_point2f_t)) );

    uint32_t * num_items_dev_ptr = NULL;
    CUDA_SAFE_CALL( cudaMalloc((void **)&num_items_dev_ptr, sizeof(uint32_t)) );
    CUDA_SAFE_CALL( cudaMemset(num_items_dev_ptr, 0, sizeof(uint32_t)) );

    nvxcu_plain_array_t arr;
    arr.base.array_type = NVXCU_PLAIN_ARRAY;
    arr.base.item_type = NVXCU_TYPE_POINT2F;
    arr.base.capacity = capacity;
    arr.dev_ptr = dev_ptr;
    arr.num_items_dev_ptr = num_items_dev_ptr;

    return arr;

And you convert it to vx_array term by term.


Thanks for replying.
I am very new with this, would be helpfull if you can elaborate your answer more. And is there anyway of converting the whole range of array directly to vx_array. ?

Just to explain the scenario in detail,

1.I want to find homography on the tracked point returned in the the sample nvxcu based feature tracking. The homography function uses vx_array. So what will be the fastest way to convert nxcu array to vx_array as i am not able to find any example for the conversion of vx_array.

  1. Next problem is that i am unable to access the element of vx_array. Will be glad i you can share the procedure for that.


To get the homography matrix, you can check our video_stabilizer sample which is located in demos.
It demonstrate from color coverting -> LK features -> homography -> warping, which should be useful for you.