what is denoise

本文探讨了利用图像信号的互独立性进行噪声减除的方法,通过方差衡量噪声强度,并介绍了一种基于哈莫密特变换的非线性信号处理技术,用于通过线性操作处理信号。博客详细讲解了如何使用对数变换和哈莫密特变换进行信号处理,以及如何通过`homomorphic_filter`函数实现这一过程。
摘要由CSDN通过智能技术生成

One

As picture signal and Additive white noise are discrete random variables: X 、 Y X、Y XY , picture can be show by : f ( X ) + g ( Y ) f(X)+g(Y) f(X)+g(Y)

∵ \because X , Y X,Y X,Y are mutually independent. Then E ( Y ) = 0 E(Y)=0 E(Y)=0

∵ \because

D ( X ) = E ( X 2 ) − E ( X ) 2 D(X)=E(X^2)-E(X)^2 D(X)=E(X2)E(X)2

E ( X Y ) = E ( X ) E ( Y ) E(XY)=E(X)E(Y) E(XY)=E(X)E(Y)

D ( X + Y ) = D ( X ) + D ( Y ) D(X+Y)=D(X)+D(Y) D(X+Y)=D(X)+D(Y)

E ( X Y ) = E ( X ) E ( Y ) E(XY)=E(X)E(Y) E(XY)=E(X)E(Y)

∴ \therefore

D ( X + Y ) = D ( Y ) D(X+Y)=D(Y) D(X+Y)=D(Y)

So If you are new to noise reduction modules, you can try using this component to measure the fluctuation of the noise you are removing. It’s not hard to see that the bigger the variance, the louder the noise.

Further, we need to know about homomorphic transformations.

what is homomorphic transformations?

Homomorphic transformation generally refers to the nonlinear combination signal through some transformation, so that it can be more convenient to use linear operation to process the signal. If you want to learn more, check out this blog post.https://blog.csdn.net/edogawachia/article/details/79368882

To describe it mathematically:

f ( x ) g ( x ) f(x)g(x) f(x)g(x) -> e l o g ( f ( x ) g ( x ) ) e^{log(f(x)g(x))} elog(f(x)g(x))-> e l o g f ( x ) + l o g g ( x ) e^{logf(x)+logg(x)} elogf(x)+logg(x)

If you want to know how to use it, this blog can give you answer. https://blog.csdn.net/wang_xinyu/article/details/111232266?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.pc_relevant_paycolumn_v2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.pc_relevant_paycolumn_v2&utm_relevant_index=5

code :

import cv2
import numpy as np


def homomorphic_filter(src, d0=10, rl=0.5, rh=2.0, c=4, h=2.0, l=0.5):
    gray = src.copy()
    if len(src.shape) > 2:
        gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)  # 转换成灰度图像

    gray = np.log(1e-5 + gray)  # 取对数

    rows, cols = gray.shape
    gray_fft = np.fft.fft2(gray)  # FFT傅里叶变换
    gray_fftshift = np.fft.fftshift(gray_fft)  # FFT中心化

    M, N = np.meshgrid(np.arange(-cols // 2, cols // 2), np.arange(-rows // 2, rows // 2))
    D = np.sqrt(M ** 2 + N ** 2)  # 计算距离
    Z = (rh - rl) * (1 - np.exp(-c * (D ** 2 / d0 ** 2))) + rl  # H(u,v)传输函数

    dst_fftshift = Z * gray_fftshift
    dst_fftshift = (h - l) * dst_fftshift + l
    dst_ifftshift = np.fft.ifftshift(dst_fftshift)

    dst_ifft = np.fft.ifft2(dst_ifftshift)  # IFFT逆傅里叶变换
    dst = np.real(dst_ifft)  # IFFT取实部

    dst = np.exp(dst) - 1  # 还原
    dst = np.uint8(np.clip(dst, 0, 255))
    return dst


img = cv2.imread('hf1.jpg')
img_new = homomorphic_filter(img)

cv2.imshow("img", img)
cv2.imshow("img_new", img_new)
cv2.imwrite("img_new1.jpg", img_new)

key = cv2.waitKey(0)
cv2.destroyAllWindows()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一只图像处理萌新

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值