compute global motion opencv 2.4.x C++
Here are 2 images, one captured before an action has been made by the surgeon and the other afterwards.
BEFORE:
AFTER:
Difference: (After - Before) + 128. (The addition of 128 is just to have a better image)
As pointed the white arrows, there has been a global motion affecting all the objects. So, I need to estimate it in order to get more valuable information on what's happening in the scene. I already knew that OpenCV 3.0 helps in this context where it's implemented some methods that estimate the dominant motion between 2 images or 2 list of points. But I'm using so far OpenCV 2.4.x because I have dependencies with libraries already installed on my machine so I'm looking for alternative solutions or any other code that does what I want.
Optical Flow:
So as you can see above, I can't differentiate between motions after computing the optical flow.
Thanks in advance.
How about using an optical flow filter with a custom build grid?
@StevenPuttemans, Can you just clarify what you said? just because I don't need to ask dump questions
Optical Flow looks how pixels move in between frames. I think it must be possible to tell it which points to track instead of all pixels. The explanation of optical flow is here and the optical flow implementation is here.
Even if I can do so? how can I get what I want? didn't get it..
IF you the optical flow or the movement from each pixel, then you can classify what has happened right?
@StevenPuttemans, Edited question
Wow wait, you can now look at the local deformation of the optical flow, which tells you which object moved alot and what is the average direction right? Secondly you could combine this with background subtraction to see what objects have actually disappeared or re-entered the image.
what do you mean by local deformation? For better understanding of the problem, you can check this link
I will not go cross forums to get your problem solved. What I mean is that the optical flow gives a direction and a size of movement. SO you can model that and try to look for areas with a minimum deformation.