Simulating lens tilt on image

13 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 12 Jun 2020
David, for your well-behaved psf I have a computationally fairly OK solution. It is based on converting the 2D-smoothing-operations into a pair of 1-D sparse matrix operations. The sparse matrices takes some time to build up, but the actual smoothing is very rapid. Since you have Gaussian kernels repeated smoothing with a narrow Gaussian results in a smoothing with a wider Gaussia you might be able to get away with less of the start-up-times.
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

Image Analyst
Image Analyst on 12 Jun 2020

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!