-2
這是我的低通濾波器實現代碼,但它無法正確過濾圖像。ButterWorth低通濾波器(BLPF)不正確地過濾圖像(C++)
我錯過了什麼使它成爲2階巴特沃斯濾波器?
輸入: - F中的FFT圖像
輸出的2D係數:LF - 巴特沃斯濾係數
void BLPF(Complex<double> *F, Complex<double> *LF, int width, int height)
{
int i, j ;
int Df ;
int centerX, centerY ;
centerX = width/2 ;
centerY = height/2 ;
Df = 32 ;
for(j = 0; j < height; j++) {
for(i = 0; i < width; i++) {
if((i - centerX) * (i - centerX) + (j - centerY) * (j - centerY) > Df * Df) {
LF[i + j * width] = 0.0 ;
} else {
LF[i + j * width] = F[i + j * width] ;
}
}
}
}