当前位置:网站首页>Bilateral filtering acceleration "recommended collection"
Bilateral filtering acceleration "recommended collection"
2022-07-31 15:11:00 【Full stack programmer webmaster】
Hello everyone, meet again, I'm your friend Quanstack Jun.
Bilateral filter is an image filtering, denoising and edge preserving filter similar to traditional Gaussian smoothing filter that considers both spatial domain and value domain information.Its template coefficient is the product of the spatial coefficient d and the range coefficient r.The idea is: the spatial coefficient is the Gaussian filter coefficient, and the value range coefficient is the difference between the pixel values of the neighboring pixels and the center pixel. When the difference is large, the value range coefficient r is small, that is, it isA decreasing function (positive half of the Gaussian function), the result is that the total coefficient w=d*r becomes smaller, reducing the influence of pixels that are more different from "me" on me.So as to achieve the effect of edge protection, and at the same time, it has a smoothing effect.
Bilateral filtering acceleration:
(1) Make a template coefficient table in advance, so that when traversing each pixel, the original multiplication and division of the coefficients become a more efficient lookup (lookup table), and a lookup table can be made for both the spatial coefficient and the value range.
(2) The separation of Gaussian filtering is simulated, and the two-dimensional bilateral filtering is decomposed into two one-dimensional bilateral filtering.First use the one-dimensional bilateral filtering template to filter the rows, and then perform column filtering on the convolution results. In this step, the original image data can be used for calculation when calculating the value range coefficients (not the intermediate results obtained by row filtering).(The number of multiplications is greatly reduced. When the template size is large, since the bilateral filter template coefficients are not as accurate and separable as the Gaussian filter template (the value range coefficients are not separable), there will be sliding along the coordinate system axis in the result.ambiguity).
(3) The pointer operation of the C language is completely used, and the running speed of the code can also be slightly improved.
Gaussian-like separation acceleration analysis of bilateral filtering: Bilateral filtering is strictly non-separable acceleration, and separation acceleration can obtain approximate results (in general, the results are better).
1. The Gaussian filter can be separated and accelerated, because the two-dimensional Gaussian function can be separated, that is, G(u,v)=g(u)*g(v), which can be directly obtained, the Gaussian template matrix G=G1*G2, the template matrix can be separated into a product of a column vector G1 and a row vector G2 (matrix multiplication).And the template does not depend on the pixel value, the template is independent of the pixel value and is fixed for the entire image.
2. For bilateral filtering: w=d*r, the value range coefficient r is related to the pixel value, the template matrix w cannot be decomposed into a product of a column vector and a row vector, and the template matrix w is related to the pixel value, not independenton the entire image.
3. Filtering separable conditions: (1) The template is independently fixed, (2) The template matrix can be decomposed into a product of a column vector and a row vector, and Gaussian-like filtering can be performed if (1) and (2) are satisfied.Separating acceleration operations.
Whether bilateral filtering can perform "FFT acceleration": bilateral filtering cannot perform FFT-based acceleration
FFT-based filtering acceleration method:
1. Fill the template and the image with 0 respectively (expand to the same size (M1+M2-1)*(N1+N2-1), and place the image and template in the upper left corner of the expansion matrix respectively)
2. The template and the image are respectively subjected to Fourier transform DFT (FFT fast algorithm)
3. Multiply the DFT results (element-wise multiplication)
4. Perform Inverse Fourier Transform IDFT (IFFT) on the multiplication result in the frequency domain
5. Intercept the time domain result obtained by the inverse Fourier transform to obtain the convolution result between the template and the image
Therefore, because the "basic FFT filtering acceleration" is a single operation to directly obtain the filtering result of the whole image, the filter template is required to be fixed and independent for the whole image, while the filter template of bilateral filtering is non-independent and fixed to the whole image, so, bilateral filtering cannot perform "basic FFT filtering acceleration".
And all Laplacian templates, prewiit, sobel and other full-image fixed, independent template filtering can be "based on FFT filtering acceleration".
Note: Due to the "basic FFT filtering acceleration" to perform 0-fill expansion, DFT, IDFT and other operations, although DFT and IDFT have fast algorithms, the computational complexity is still high, usually, when the template size (diameter) is less than 50, the traditional method is faster than the "radix FFT".
Summary: For small templates, use the traditional method or if separable, consider the separable method, and for larger templates, choose the "Radical FFT filtering acceleration" method.
The principle of "basic FFT filtering acceleration": convolution theorem, DFT( f(x)*h(x) ) = DFT( f(x) ) * DFT( h(x) ), the convolution of two signalsThe Fourier transform is equal to the product of the respective Fourier transforms (the time domain convolution is equal to the frequency domain product)
Publisher: Full-stack programmer, please indicate the source: https://javaforall.cn/128340.htmlOriginal link: https://javaforall.cn
边栏推荐
猜你喜欢
深入浅出边缘云 | 4. 生命周期管理
工程流体力学复习
2021 OWASP TOP 10 Vulnerability Guide
OpenCV测量物体的尺寸技能 get~
TCP详解
leetcode303 Weekly Match Replay
为什么毕业季不要表白?
The meaning of node_exporter performance monitoring information collection in Prometheus
Excel快速对齐表格的中姓名(两个字姓名和三个字姓名对齐)
Getting started with UnityShader (3) - Unity's Shader
随机推荐
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(legend、修改可视化图像的图例在整图中的位置)
c语言hello world代码(代码编程入门)
R语言向前或者向后移动时间序列数据(自定义滞后或者超前的期数):使用dplyr包中的lag函数将时间序列数据向前移动一天(设置参数n为正值)
OpenShift 4 - Deploy Redis Cluster with Operator
Node实现数据加密
Gorm—Go语言数据库框架
2021 OWASP TOP 10 漏洞指南
双边滤波加速「建议收藏」
leetcode303场周赛复盘
华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东
RecyclerView高效使用第二节
Network cable RJ45 interface pins [easy to understand]
Unity Shader入门精要学习——透明效果
名创优品斥资6.95亿购买创始人叶国富所持办公楼股权
Ubantu专题4:xshell、xftp连接接虚拟机以及设置xshell复制粘贴快捷键
abaqus find contact pairs报错:surface name is already in use
架构实战营模块8消息队列表结构设计
自动化测试如何创造业务价值?
R语言的画图代码及差异性分析[通俗易懂]
JVM参数解析 Xmx、Xms、Xmn、NewRatio、SurvivorRatio、PermSize、PrintGC「建议收藏」