Lucas-Kanade Optical Flow Example

Click Start/Stop button to start or stop the video.
The videoInput is a <video> element used as input. The canvasOutput is a <canvas> element used as output.
To decide the points, we use cv.goodFeaturesToTrack(). We take the first frame, detect some Shi-Tomasi corner points in it, then we iteratively track those points using cv.calcOpticalFlowPyrLK.
The code of <textarea> will be executed when video is started.
You can modify the code to investigate more.