Shepard's distortion #2352
toetienne
started this conversation in
Show and tell
Replies: 1 comment 3 replies
-
Hi @tourtiere, That's very cool! I didn't realize Shepard was so straightforward. You can make your loop very slightly faster with: for p1, p2 in couples:
diff = index - p2
distance = (diff[0]**2 + diff[1]**2)
distance = distance.ifthenelse(distance, 0.1)
weight = 1.0 / distance
delta = [(p1[0] - p2[0]), (p1[1] - p2[1])] * weight
weights.append(weight)
deltas.append(delta)
# add, normalize
index += pyvips.Image.sum(deltas) / pyvips.Image.sum(weights) Though it doesn't make a lot of difference. I added a (1/x) shortcut to pow in git master libvips which helps a little too. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Just a quick note to say that I previously used ImageMagick and its shepard command to distort large orthophoto mosaics, but it was using too much RAM. I found libvips and its mapim command so I came up with this script and it really improved my project: https://github.com/tourtiere/light-distortion. Feel free to use it as you want in the examples.
Libvips is very powerful and fun to use. Thank you John and other contributors for this incredible work, have a nice day to you all
Beta Was this translation helpful? Give feedback.
All reactions