~example fixed

This commit is contained in:
Dmitry Ivanovm 2017-03-08 16:40:59 -05:00
parent 9edf312229
commit 833c81d596

View File

@ -35,6 +35,9 @@ cap.read(function(err, firstFrame) {
cap.read(function(err, newFrame) {
if (err) throw err;
var frameSize = newFrame.size();
if ( frameSize[0] > 0 && frameSize[1] > 0) {
var goodFeatures = old_frame.goodFeaturesToTrack(feature_params.maxCorners, feature_params.qualityLevel, feature_params.minDistance);
// calculate optical flow
@ -48,12 +51,15 @@ cap.read(function(err, firstFrame) {
out.line(flow.old_points[i], flow.new_points[i], color);
}
}
/*
window.show(out);
window.blockingWaitKey(0, 50);
*/
old_frame = newFrame.copy();
read();
}
});
}