I am trying to run VPI’s PyrLK optical flow algorithm for tracking specific points. i managed to do it in python by setting up a numpy array and then using vpi.asarray on it, but i can’t seem to be able to access the algorithm parameter struct. regardless i would prefer running it on cpp, but i don’t know how. i’ve managed to insert points into the feature array but they are all lost in 1 iteration.
my code snippet for python :
custom_points = np.array([[200,100],],dtype=np.float32)
curFeatures = vpi.asarray(custom_points)
with backend:
optflow = vpi.OpticalFlowPyrLK(frame,curFeatures,pyramid_levels)
this works great with the rest of the code example in the library, but i can’t access the pyrLK params.
in c++ i have managed to insert points into curFeatures like this:
vpiArrayLockData(curFeatrues,VPI_LOCK_READ,VPI_ARRAY_BUFFER_HOST_AOS,&array_data);
std::vector<VPIKeypointF32> points = {{200,100}};
array_data.buffer.aos.data = points.data();
*array_data.buffer.aos.sizePointer = 1;
vpiArrayUnlock(curFeatures);
it recognizes that it tracks 1 point but it losses it after 1 iteration.
i would really appreciate any help with manually inserting points into the c++ code, if you want i can upload the entire code. thank you