Are the GPUImageBilateralFilter parameters of the GPUImage iOS Library the equivilent of Photoshop Surface Blur parameters?

折月煮酒 提交于 2019-12-13 19:08:18

问题


I understand that a Surface Blur in Photoshop is a bilateral filter.

In the iOS Library GPUImage there is a filter GPUImageBilateralFilter with parameters of texelSpacingMultiplier and distanceNormalizationFactor.

Would these match up directly to the Photoshop Surface Blur options of radius and threshold (respectively)? And would the values to these parameters be the same?

Thanks!


回答1:


Not exactly.

With your standard Gaussian blurs, you typically specify a pixel radius (or sigma value in pixels) to define the blur strength. Before the recent overhaul of the blurs, you couldn't specify something like this in GPUImage. The blurs instead used a fixed number of samples, with a fixed value of sigma. You could expand them slightly by adjusting the pixel spacing between samples (the texelSpacingMultiplier, which is 1.0 by default).

With my recent revamp of the blurs, you now can specify a true pixel radius for the blur, which in the case of a Gaussian blur sets the size of sigma. When you do this, it generates a shader on the fly that works over the appropriate number of pixels to yield a blur of that strength. The use of sigma here matches Core Image's behavior exactly, although I haven't tested it against Photoshop.

However, the bilateral blur is the last of the blurs that I've needed to update to bring it inline with the others. I haven't yet, so you don't have a great way to bring it in line with Photoshop's behavior yet. This is on my to-do list, but that's fairly lengthy at this point. You're welcome to take a look at how I converted over something like the box blur and to try to adapt the bilateral blur math to enable this for that filter.

The distanceNormalizationFactor isn't related to the blur size, but it works to weight the way that pixel colors are processed from the sampled pixels around the central one. A bilateral blur works by blurring the central color only with surrounding colors that are close enough to the central one (thus preserving edges). This weighting value controls how close a color needs to be to the central pixel's color in order for the center pixel to be blended with it.



来源:https://stackoverflow.com/questions/20817630/are-the-gpuimagebilateralfilter-parameters-of-the-gpuimage-ios-library-the-equiv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!