Fluid with jit.repos and cv.jit.opticalflow

Rajan Craveri - micron's icon

Hi,
inspired by Axiom Crux and Andrew Benson I'm trying to create a fluid patch based on jit.optical flow
but I lose negative value after jit.slide
maybe it is possible use jit.expr instead jit.slide?

Max Patch
Copy patch and select New From Clipboard in Max.

any help is appreciated ;)

Andrew Benson's icon

On a quick glance, I would blame it on the lack of a @slide_up attribute to match the @slide_down 20.

So, values increasing will happen instantly and decreasing will be slowed down. I'd recommend adding jit.* to your optical flow stream to scale the motion. It might also be an idea to use float32 instead of long for accumulating movement.

Rajan Craveri - micron's icon

Thanks! You are right!
Now I'll try to bring it on GPU.

aceslowman's icon

I know I'm reviving an old thread, but I would be curious if anyone has some input on how to get this to run on GPU.

So far I feel like I am getting close, but here are the problems I have run into so far:

1. The pixels return to their original position over time, I can't get them to 'stick'. I would assume it is because I am not actually rearranging anything in the texture, only displacing it on the way out.
2. Also, movement in one direction seems restricted. This is present in micron's patch as well.
3. When subtracting the result of 'slide', I don't appear to get the same output as Micron's patch.

Is there anyone with some advice on how to fix this up and get it running on the GPU?

Max Patch
Copy patch and select New From Clipboard in Max.



Rob Ramirez's icon

type "fluid gpu" into the search bar and check out the first hit

aceslowman's icon

Great! I came across this recently, but I noticed that it was using a different approach, and the end result looks much different. Mainly looking to get this patch working, it has a different appearance that I'm really enjoying. After that, I will begin picking apart these other methods.