MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ track_keypoints() [1/2]

MAYAFLUX_API std::vector< TrackResult > MayaFlux::Kinesis::Vision::track_keypoints ( std::span< const float >  prev_gray,
std::span< const float >  curr_gray,
std::span< const float >  grad_dx,
std::span< const float >  grad_dy,
uint32_t  w,
uint32_t  h,
std::span< const glm::vec2 >  prev_points,
uint32_t  window_radius = 7,
uint32_t  max_iterations = 20,
float  eigen_threshold = 1e-4F,
float  error_threshold = 0.3F 
)

Track keypoints using a pre-computed Sobel gradient of prev_gray.

Identical to the four-parameter overload but accepts caller-supplied dx and dy of the previous frame, avoiding recomputation when the gradient is already cached. dx and dy must be the Sobel gradient of prev_gray at the same w x h resolution.

Parameters
prev_grayPrevious frame, single-channel float, size w * h.
curr_grayCurrent frame, single-channel float, size w * h.
grad_dxHorizontal Sobel gradient of prev_gray, size w * h.
grad_dyVertical Sobel gradient of prev_gray, size w * h.
wImage width in pixels.
hImage height in pixels.
prev_pointsPoints to track in normalised [0, 1] coordinates.
window_radiusHalf-size of the tracking patch in pixels.
max_iterationsMaximum Newton-Raphson iterations per point.
eigen_thresholdMinimum eigenvalue for structure tensor validity.
error_thresholdMaximum residual error to accept a track.
Returns
TrackResult per input point, same order.

Definition at line 189 of file OpticalFlow.cpp.

200{
201 const size_t np = prev_points.size();
202 std::vector<TrackResult> results(np);
203
204 P::for_each(P::par_unseq,
205 std::views::iota(size_t { 0 }, np).begin(),
206 std::views::iota(size_t { 0 }, np).end(),
207 [&](size_t i) {
208 results[i] = lk_point(
209 prev_gray, curr_gray,
210 grad_dx, grad_dy,
211 w, h,
212 prev_points[i],
213 window_radius,
214 max_iterations,
215 eigen_threshold,
216 error_threshold);
217 });
218
219 return results;
220}
uint32_t h
Definition InkPress.cpp:28

References h.