Displacement Map Filter in OpenCV
Asked Answered
A

2

13

I'm curious to know how one can implement the effect demonstrated here using OpenCV. I think it's some sort of displacement map filter but I'm not 100% sure.

After that page has fully loaded, move the mouse around to see the background image move (it's the effect I'm looking for).

Is it possible? How would I go about doing it?

Amarillis answered 13/2, 2012 at 12:41 Comment(0)
A
23

It's been almost 2 years since I've asked this question and I think it's time to answer it: the source code that implements this filter using OpenCV can be found in my GitHub repo.

The implementation is based on the documentation of Adobe Flash DisplacementMapFilter.

There's another tutorial I recommend people to read: Psyark’s DisplacementMapFilter Tutorial. It's old but accurate.

The result:

Output

Amarillis answered 19/12, 2013 at 4:24 Comment(1)
This is amazing! Thanks for getting back to it after so many years. It's 2017 and it's still amazing.Centesimo
L
1

Naturally, I don't know what they are using on this page. But you can get a similar effect using Parallax Mapping applied to a flat surface. In this case there is no occlusion, which makes it faster.

There is a shader implementation in this thread which should be easy enough to translate to a kernel.

Here is another link that uses this technique for photos.

Landsknecht answered 13/2, 2012 at 13:51 Comment(1)
Hi! I just answered this question and I though you might be interested in taking a look at my results. Have a nice day!Amarillis

© 2022 - 2024 — McMap. All rights reserved.