Vignette correction #4419
Replies: 3 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
Hi @kipcole9, I've always used a cosine for this, but I guess a parabola works as well. It probably doesn't matter much. In ruby you could write: #!/usr/bin/ruby
require 'vips'
image = Vips::Image.new_from_file ARGV[0], access: :sequential
vignette = Vips::Image.xyz image.width, image.height
# move origin to centre
vignette = vignette - [image.width / 2, image.height / 2]
# to polar, then take just distance
vignette = vignette.polar[0]
# raised cosine
vignette = (vignette * (ARGV[2].to_f / image.width)).cos
# apply to image
image = image * vignette
image.write_to_file ARGV[1] ie. use Your parabola function is probably quicker and just as good. |
Beta Was this translation helpful? Give feedback.
-
Thanks as always John. The parabola comes from matching to the parameters from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working to add vignette correction to image using the correction data from lensfun.
I've implemented what I think is the right algorithm, but clearly I've messed up somewhere. Hoping someone with more knowledge than me (pretty much everyone) can give me some guidance.
Here's an example. It's in Elixir but I think its readable to anyone who has worked with Ruby or Python.
This results in the following image. The image darkens (rather than lightens) towards the edges. And the corners aren't correct either (I think).
Any and all guidance warmly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions