The first time calcOpticalFlowPyrLK is calculating, the old_gray and gray_frame are not consecutive. This is why you see the green point not exactly where you clicked.
Any help please ? Traceback (most recent call last): File "C:\Users\ppant\Downloads\New folder (8)\lucas-kande.py", line 44, in cv2.circle(frame, (x, y), 5, (0, 255, 0), -1) cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'circle' > Overload resolution failed: > - Can't parse 'center'. Sequence item with index 0 has a wrong type > - Can't parse 'center'. Sequence item with index 0 has a wrong type
Hi! Could it be the shutter speed why the detection of new points isn't so good? A webcam has a slow shutter speed, so motion blur might become a problem when analyzing fast moving objects.
HI Marius, thanks for this interesting explanation. It's really likely that it affects the detection, considering I'm using the original webcam of my laptop, and so it's not that good.
I would suggest using an AI network to identify and know what risky situations are. Then you could use Optical Flow to read the movements in the environment. From there the AI would process and identify if the situation is risky.
HI! I am a taiwanese student , my english is not so well, but i want to ask a question ,how could i track two points at the same time , I try it myself, but it didnt work ,can you tell me some tips?
You should make a few changes, probably it's easier to write it from scratch if you want make it work for 2 ore more points. I suggest you to take a look at the original docs and experiment with them. opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_video/py_lucas_kanade/py_lucas_kanade.html#lucas-kanade
thank you very much! I will read that web page! By the way ,Can I add your facebook or instagram? I am using opencv to do a little project I think i will have some question that I can contact you easier, if you can accept