Hello,
I would like to get and print (x,y) coordinates from points stored in the vx_array such as the lines from nvx_demo_feature_track code.
vx_array old_points = tracker->getPrevFeatures();
vx_array new_points = tracker->getCurrFeatures();
Thanks
Derived from the post https://devtalk.nvidia.com/default/topic/1032913/jetson-tk1/vx_array-access-feature_tracker-demo/post/5396508/#5396508
the code snip works fine
vx_array new_points = tracker->getCurrFeatures();
std::vector<cv::Point2f> fPts;
vx_size numItems = 0;
vx_size stride = sizeof(vx_size);
void *base = NULL;
vxQueryArray(new_points, VX_ARRAY_ATTRIBUTE_NUMITEMS, &numItems, sizeof(numItems));
vxAccessArrayRange(new_points, 0, numItems, &stride, &base, VX_READ_ONLY);
if (numItems > 0)
{
vx_size oldStride;
vx_size newStride;
vx_map_id oldMap;
vx_map_id newMap;
vx_uint8* oldBuff;
vx_uint8* newBuff;
vxMapArrayRange(new_points, 0, numItems, &newMap,
&newStride, (void **) &newBuff,
VX_READ_ONLY, VX_MEMORY_TYPE_HOST, 0);
for (vx_size i = 0; i < numItems; i++)
{
nvx_keypointf_t* kpNew = (nvx_keypointf_t*)(newBuff + i * newStride);
std::cout << ":: tracking_status:" << (vx_int32)kpNew->tracking_status << std::endl;
if (kpNew->tracking_status)
{
fPts.push_back(cv::Point2f(kpNew->x, kpNew->y));
std::cout << ":: x:" << kpNew->x << ":: y:" << kpNew->y << ":: num:" << i << std::endl;
}
}
vxUnmapArrayRange(new_points, newMap);
}
kayccc
3
Nice! Thanks for the sharing!