MATLAB Answers

Simulating lens tilt on image

5 views (last 30 days)
David H
David H on 9 Jun 2020
Commented: Bjorn Gustavsson on 17 Jun 2020
I am currently trying to simulate the effect of lens tilt on a flat image (i.e., one that does not contain multiple depths of field). The lens would be tilted in both RX and RY, so in a direction not aligned with the plane of the photo.
Is there currently anything within the image processing tool box that does this? If not, is there a known algorithm to produce the effect of the tilted plane of focus?
  5 Comments
Bjorn Gustavsson
Bjorn Gustavsson on 17 Jun 2020
Did the suggestions from Image Analyst and me help? The two suggestions should take care of both perspective effects and PSF-variations.

Sign in to comment.

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 10 Jun 2020
OK, here's a two thirds (some reasonable-fraction) solution that computationally is not too shabby. In its current version it allows for a combination of horizontal smoothing that varies in the vertical image-direction and a vertical smoothing that varies in the horizontal direction. It builds separate sparse smoothing-matrices for each separate direction, this takes a bit of time, the actual smoothing is then only a pair of vector-sparse-matrix ultiplications and rather efficient. I think this is approximately what you need - your Gaussian PSFs are trivially separable (10 s of Gauss-aweing) so that should be fine, the function should be expanded to allow for smoothings that varies at least as Kxx, Kxy, Kyy, and Kyx. It might be possible to be very clever and come up with a decomposition of more general PSF - similar to what is used in convolve2, but that is TBD.
HTH

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!