learnopencv icon indicating copy to clipboard operation
learnopencv copied to clipboard

Optical-Flow-in-OpenCV

Open niu1970 opened this issue 2 years ago • 2 comments

(yolov5) C:\Users\renfang\Desktop\基于视频的车辆转弯安全提醒方案\Optical-Flow-in-OpenCV>python demo.py --algorithm lucaskanade --video_path videos\people.mp4 Traceback (most recent call last): File "demo.py", line 38, in main() File "demo.py", line 24, in main lucas_kanade_method(video_path) File "C:\Users\renfang\Desktop\基于视频的车辆转弯安全提醒方案\Optical-Flow-in-OpenCV\algorithms\lucas_kanade.py", line 33, in lucas_kanade_method good_new = p1[st == 1] TypeError: 'NoneType' object is not subscriptable

niu1970 avatar Dec 08 '21 14:12 niu1970

This is perhaps happening because the corner detector was not able to track the keypoints (corners) in the new image. Hence, p1 came out to be None. You should handle this case by using try/Except.

metro-smiles avatar Dec 17 '21 23:12 metro-smiles

I saw your article in website:[https://learnopencv.com/optical-flow-in-opencv/#disqus_thread] DenseOpticalFlow , there is a special image in the part of algorithm visualization of Dense Optical Flow, which used lines to draw optical flow. I don't know whether can you see this image or not. And the code in your personal website can not get this image. can you answer my question? Thank you!

Souleymane0511 avatar Feb 12 '22 07:02 Souleymane0511