mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
~example fixed
This commit is contained in:
parent
9edf312229
commit
833c81d596
@ -35,6 +35,9 @@ cap.read(function(err, firstFrame) {
|
|||||||
cap.read(function(err, newFrame) {
|
cap.read(function(err, newFrame) {
|
||||||
if (err) throw err;
|
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);
|
var goodFeatures = old_frame.goodFeaturesToTrack(feature_params.maxCorners, feature_params.qualityLevel, feature_params.minDistance);
|
||||||
|
|
||||||
// calculate optical flow
|
// calculate optical flow
|
||||||
@ -48,12 +51,15 @@ cap.read(function(err, firstFrame) {
|
|||||||
out.line(flow.old_points[i], flow.new_points[i], color);
|
out.line(flow.old_points[i], flow.new_points[i], color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
window.show(out);
|
window.show(out);
|
||||||
window.blockingWaitKey(0, 50);
|
window.blockingWaitKey(0, 50);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
old_frame = newFrame.copy();
|
old_frame = newFrame.copy();
|
||||||
read();
|
read();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user