You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Happy to say I'm making good progress on feature request #118. Everything is working as intended and all tests are passing. There is one complication, however.
In ResizeWorker::Execute, sharp applies a Gaussian blur prior to large affine reductions. To do so, it generates a square Gaussian image based on the standard deviation of the residual. This is fine if the aspect ratio is preserved, but I suspect a square kernel is not suitable for "non-aspect" reductions.
I'd love to hear ideas on how to proceed. Thinking out loud:
Generate a Gaussian image based on the smaller residual (x or y), and box-shrink it to match the new aspect?
The kernel should probably have odd dimensions after the shrink.
If I'm not mistaken, libvips' separable convolution won't work for a non-square kernel, meaning non-aspect reductions won't be as optimized.
Also, I have to confess ignorance as to why a blur is applied prior to large affine reductions in the first place. Feel free to clue this image-processing newbie in.
The text was updated successfully, but these errors were encountered:
The Gaussian blur is to reduce the effects of aliasing when performing a large affine reduction. I suspect you'll still need this if either x or y residuals are < 1.
If you've not already tried it, a quick approach might be to use the average of x and y residual factors as the single residual input to the sigma approximation. You'd need to manually inspect a few images to see how this looks, especially as the difference between x and y factors increases.
Good call on averaging the residuals. Here's the test image (512x512):
And results of down-scaling to the following non-integral dimensions (cropped and magnified):
The hard vertical edge is preserved in the first case which is perfect since no horizontal scaling occurs. The blur doesn't become perceptible until the x and y residuals reach more of a parity. These results were computed using the "nohalo" interpolator.
I'll go ahead with this approach in the provisional PR.
Happy to say I'm making good progress on feature request #118. Everything is working as intended and all tests are passing. There is one complication, however.
In ResizeWorker::Execute, sharp applies a Gaussian blur prior to large affine reductions. To do so, it generates a square Gaussian image based on the standard deviation of the residual. This is fine if the aspect ratio is preserved, but I suspect a square kernel is not suitable for "non-aspect" reductions.
I'd love to hear ideas on how to proceed. Thinking out loud:
Also, I have to confess ignorance as to why a blur is applied prior to large affine reductions in the first place. Feel free to clue this image-processing newbie in.
The text was updated successfully, but these errors were encountered: