Applying dense optical flow to image

asked 2018-01-12 05:05:04 -0500

salahuddin_12 gravatar image

I need help in applying dense optical flow to an image. This is how I'm generation flow:

flow = cv2.calcOpticalFlowFarneback(prev,next, None, 0.5, 3, 15, 3, 5, 1.2, 0)

I want to apply this flow to prev image to somehow create next image. Any idea how this is possible? I'm using python 2.7 and opencv 3.1

Following is next image:

image description

Following is prev image:

image description

Purpose of this exercise is to replicate DeepWrap gaze manipulation paper. https://sites.skoltech.ru/compvision/...

There is already a solution available but I guess it for some different version. https://stackoverflow.com/questions/4...

edit retag flag offensive close merge delete

Comments

1

it's unclear, where your actual problem is.

please have a look at the python sample , then please refine your question.

berak gravatar imageberak ( 2018-01-12 05:10:29 -0500 )edit

What i'm trying to do is, I'm trying to regenerate next image from prev image. I thought that there might be some way to do this by applying optical flow values to prev image

salahuddin_12 gravatar imagesalahuddin_12 ( 2018-01-12 05:16:11 -0500 )edit

"regenerate next image from prev image" -- what ? you're trying to see into the future ?

berak gravatar imageberak ( 2018-01-12 05:21:26 -0500 )edit

Isn't it possible when we have already calculated flow values by using both next and prev images?

salahuddin_12 gravatar imagesalahuddin_12 ( 2018-01-12 05:27:29 -0500 )edit
1

ok,ok, apologies, i misread it. well, you cannot generate a future image from a current one, but you could try to extrapolate the flow from prev -> current to make some prediction.

(cool paper, thanks ;)

berak gravatar imageberak ( 2018-01-12 05:45:24 -0500 )edit
1

I think i was unable to explain my question, but the link which you shared really helped. All i was asking how to write warp_flow method.

salahuddin_12 gravatar imagesalahuddin_12 ( 2018-01-12 05:46:12 -0500 )edit
1

@salahuddin_12 , please come back with an answer, if you can get something rolling !

berak gravatar imageberak ( 2018-01-12 05:59:41 -0500 )edit

@salahuddin_12, do you mean that you want to move from prev image to next image then to next image and so on?

supra56 gravatar imagesupra56 ( 2018-01-12 09:09:43 -0500 )edit