当前位置:网站首页>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
边栏推荐
猜你喜欢
Word table to Excel
OpenShift 4 - Deploy Redis Cluster with Operator
华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东
DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
安装Xshell并使用其进行Ymodem协议的串口传输
分成两栏后文字顺序混乱的问题解决【写期刊论文时】
WeChat chat record search in a red envelope
TRACE32——基于SNOOPer的变量记录
Prometheus之node_exporter性能监控信息采集含义
「秋招系列」MySQL面试核心25问(附答案)
随机推荐
基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
TRACE32 - SNOOPer-based variable logging
使用 PyTorch 检测眼部疾病
SQL、HQL、JPQL 到底有什么区别
charles进行弱网测试(app弱网测试怎么做)
Essential Learning for Getting Started with Unity Shader - Transparency Effect
Getting started with UnityShader (3) - Unity's Shader
工程水文学名词解释总结
TRACE32——基于SNOOPer的变量记录
浏览器自带的拾色器
消息队列消息数据存储MySQL表设计
AVH Deployment Practice (1) | Deploying the Flying Paddle Model on Arm Virtual Hardware
Getting started with UnityShader (1) - GPU and Shader
工程流体力学复习
深入浅出边缘云 | 4. 生命周期管理
Unity Shader入门精要学习——透明效果
安装Xshell并使用其进行Ymodem协议的串口传输
ASP.NET Core 产生连续 Guid
Gorm—Go语言数据库框架
谷歌CTS测试(cta测试)