Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 623 Bytes

File metadata and controls

27 lines (20 loc) · 623 Bytes

Optical Flow Module (contrib)

Dense optical flow using the Dual TVL1 algorithm.

DualTVL1OpticalFlow

const DualTVL1OpticalFlow = struct {
    fn create() !DualTVL1OpticalFlow;
    fn deinit(self: *DualTVL1OpticalFlow) void;
    fn calc(self: DualTVL1OpticalFlow, prevImg: Mat, nextImg: Mat, flow: *Mat) void;
};

Example

const cv = @import("zopencv");

var flow = try cv.contrib.optflow.DualTVL1OpticalFlow.create();
defer flow.deinit();

var result = try cv.Mat.init();
defer result.deinit();
flow.calc(prev_gray, next_gray, &result);
// result is a 2-channel float Mat (dx, dy per pixel)