Dark Frame Subtraction

暗帧减法是数码摄影中减少长曝光图像噪声的一种方法,它利用暗帧(即在黑暗中拍摄的图像)来修正固定图案噪声,如由暗电流引起的噪声。该技术有助于消除热像素,并在天文摄影、卫星和航空摄影测量中得到应用。暗帧的曝光时间和拍摄条件应与原始图像保持一致,以确保有效去除相同位置的热像素。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在手册阅读中,经常能看到,直译为暗帧么?那作用又是什么,一直不解。
问度娘得到了wiki的介绍:
In digital photography, dark-frame subtraction is a way to minimize image noise for pictures taken with long exposure times. It takes advantage of the fact that a component of image noise, known as fixed-pattern noise, is the same from shot to shot: noise from the sensor, dead or hot pixels. It works by taking a picture with the shutter closed.
A dark frame is an image captured with the sensor in the dark, essentially just an image of noise in an image sensor. A dark frame, or an average of several dark frames, can then be subtracted from subsequent images to correct for fixed-pattern noise such as that caused by dark current. Dark-frame subtraction has been done for some time in scientific imaging; many newer consumer digital cameras offer it as an option, or may do it automatically for exposures beyond a certain time.
Visible fixed-pattern noise is often caused by hot pixels – pixel sensors with higher than normal dark current. On long exposure, they can appear as bright pixels. Sensors on the CCD that always appear as brighter pixels are called stuck pixels while sensors that only brighten up after long exposure are called hot pixels.
The dark-frame-subtraction technique is also used in digital photogrammetry, to improve the contrast of satellite and air photograms, and is considered part of “best practice”, along with flat-field correction, for astrophotography.


在数码摄影中,暗帧减法是针对长曝光减小图像噪声的一种方法。利用了一种图像噪声的特性,固定图形噪声,点到点对应:从传感器中的噪声,类似固定的或者热噪点。通过关闭光栅进行拍摄得到的图片进行处理。
暗帧是指摄像头在黑暗中捕捉的图像,尤其是在图像传感器上的噪声。一张或者多张暗帧,可以用于修正固定图形噪声,那些由于暗电流产生的噪声。暗帧减法被应用在科学成像上,现在很多新的消费类数码相机提供暗帧减法作为可选项,或者在曝光时间超过一定时自动进行。
可见固定图形噪声通常是由热像素:像素元以高于正常的电流进行工作时。在长曝光中,这些以明亮的像素点方式呈现。在CCD传感器中,经常呈现为过亮的像素点为stuck pixels,而只有在长曝光以后呈现的过亮的像素点成为热噪点。
暗帧减法技术也用于数字摄影测量,提高卫星的对比和air photograms,并被认为是“最佳实践”的一部分,随着平面场校正,天体摄影术。


这里写图片描述

把上面的红色区域放大后,噪点变得明显了,
这里写图片描述

当感光元件运作数秒后,热力便会产生,这时候,电子讯号出现不稳,从而形成了杂讯。那是因为电子原件热力所引发的杂讯称做为Hot Pixels

如何拍摄Dark Frames
当镜头被盖上,然后进行长曝光,拍出来的应该是全黑的相片么?答案是否定的。把相片放大后,大家会发现红点绿点充斥在黑色的背景中,其实这就是Dark Frame了
下图放大后的Dark Frame照片
这里写图片描述

Hot Pixels不是经常出现在相同的位置,但感光原件(CCD/CMOS)的温度,设定和曝光时间都很接近时,Hot Pixels会有较大的概率出现在相同的位置。Hot Pixels要出现在相同位置后,我们才能通过后期制作区去除他们。
下图两种为连续拍摄的Dark Frame。比较之下,可以发现Hot Pixels出现的地方并不完全相同。
这里写图片描述

曝光时间也很重要,大家应该体会到曝光时间越长,噪点越多的事实。因此,当夜景相片的曝光为3 分钟时,Dark Frames 的曝光时间也应该是 3 分钟 。Dark Frames 和原相的曝光时间必須相同,以增加 Hot Pixels 出現在相同位置的机会。
还有,气温会影响Hot Pixels 的位置与多寡。因此,Dark Frames 应该在拍摄原相后,立即拍摄,以求俩者拍摄時的温度一致。
最后,相机的所有设定,特別是 ISO 应该保持原状,务求令 Hot Pixels 出现在相同的位置。

### 频谱减法技术原理 频谱减法是一种用于去除加性噪声的有效方法,特别适用于语音增强领域。该算法基于假设:干净信号的短时傅里叶变换(STFT)系数与噪声的STFT系数相互独立[^1]。 对于给定的一帧带噪语音 \( X(k,n) \),其中 \( k \) 表示频率索引而 \( n \) 是时间帧编号,则可以表示为: \[ X(k, n) = S(k, n) + N(k, n) \] 这里 \( S(k, n) \) 和 \( N(k, n) \) 分别代表纯净语音和背景噪声对应的复数域表达形式。为了估计原始无干扰的声音部分,在理想情况下可以直接通过简单的相减操作来获得近似解: \[ Y(k, n) = |X(k, n)| - G|N(k, n)| \] 然而实际应用中由于存在不确定性以及可能存在的非平稳特性等因素影响,通常会引入增益因子 \( G \) 来调整补偿程度并防止过抑制现象的发生。 ```python import numpy as np def spectral_subtraction(noisy_signal, noise_frame, alpha=0.98): """ Perform basic spectral subtraction on noisy signal. Parameters: noisy_signal (array): Input array containing the noisy speech frames. noise_frame (array): Array representing an estimate of the noise spectrum. alpha (float): Smoothing factor for power spectra estimation. Returns: clean_estimated (array): Estimated cleaned-up audio data after applying SS technique. """ # Compute STFTs stft_noisy = np.fft.rfft(noisy_signal) stft_noise = np.fft.rfft(noise_frame) magnitude_spectra_ratio = abs(stft_noisy)**2 / (abs(stft_noise)**2 + 1e-10) smoothed_magnitude_spectrum = [] prev_mag_spec = None for mag_spec in magnitude_spectra_ratio.T: if prev_mag_spec is not None: current_smoothed = alpha * prev_mag_spec + (1-alpha)*mag_spec else: current_smoothed = mag_spec smoothed_magnitude_spectrum.append(current_smoothed) prev_mag_spec = current_smoothed.copy() enhanced_stft = stft_noisy * ((smoothed_magnitude_spectrum).T ** .5) clean_estimated = np.real(np.fft.irfft(enhanced_stft)) return clean_estimated ``` 此Python函数实现了基本版本的频谱减法过程,它接收含有噪音的话语片段及其对应静音期间获取到的一个典型噪音样本作为输入参数,并返回经过处理后的较为清晰的话音序列。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值