当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
thread_local 变量的析构顺序
Prometheus之node_exporter性能监控信息采集含义
Codeforces Round #796 (Div. 2)(A-D)
定时器的类型
深入浅出边缘云 | 4. 生命周期管理
腾讯云部署----DevOps
OpenCV测量物体的尺寸技能 get~
梅克尔工作室-第一次
TRACE32 - Common Operations
MANIFEST.MF文件(PDB文件)
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the grouped box plot, use the ggpar function to change the graphical parameters (caption, add, modify th
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(legend、修改可视化图像的图例在整图中的位置)
Efficient use of RecyclerView Section 1
自适应控制——仿真实验三 用超稳定性理论设计模型参考自适应系统
Linux查看redis版本(查看mongodb版本)
Female service community product design
使用 PyTorch 检测眼部疾病
NPM淘宝镜像(最新版本)于2021-11-21 16:53:52发布新版本npm镜像[通俗易懂]
R language moves time series data forward or backward (custom lag or lead period): use the lag function in the dplyr package to move the time series data forward by one day (set the parameter n to a p
R语言检验样本是否符合正态性(检验样本是否来自一个正态分布总体):shapiro.test函数检验样本是否符合正态分布(normality test)