Skip to content

Conversation

@knorth55
Copy link
Contributor

@knorth55 knorth55 commented Feb 19, 2025

lk_flow is on method for sparse optical flow, so matching between prev_flow (point[0]) and flow (point[1]) is important.
But current implementation drops the information and resize flow to shrink the size, which drops the matching information.
This PR adds status array (bool) to show if the point is tracked or lost.

This PR

This is the simple example, so only (x, y) is registered for each point.

point[0] = [(10, 11), (12, 13), (34, 37)] 
point[1] = [(11, 12), (0, 0), (33, 36)]  # keep the length as 3
status = [True, False, True] # 2nd point is lost

Current implementation

# 1st point is lost
point[0] = [(10, 11), (12, 13), (34, 37)] 
point[1] = [(11, 12), (33, 36)]  # 2nd point is lost, and resized!!!!! cannot match the points!!!!

https://docs.opencv.org/3.4/d4/dee/tutorial_optical_flow.html

@knorth55 knorth55 changed the title Keep flow index and publish status [lk_flow] Keep flow index and publish status Feb 19, 2025
@knorth55 knorth55 changed the title [lk_flow] Keep flow index and publish status [lk_flow] Keep matching information for sparse optical flow Feb 19, 2025
@k-okada k-okada merged commit 695bb11 into ros-perception:indigo Feb 21, 2025
13 checks passed
@k-okada
Copy link
Contributor

k-okada commented Feb 21, 2025

@knorth55 thanks for contribution. BTW what kind of application are you using. Is there any nice program that takes output of optical flow?

@knorth55
Copy link
Contributor Author

BTW what kind of application are you using.

Now I'm working on a robot to grasp moving object.

Is there any nice program that takes output of optical flow?

Now I'm implementing my program to follow the moving object, and it is the same layer as euslisp.
I simply track the optical flow, calculate affine by least square method and use the affine to the robot motion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants