DFT 带阻滤波器

This commit is contained in:
nuknal
2024-06-21 12:47:14 +08:00
parent e13038474a
commit d99b8a9740
16 changed files with 292 additions and 309 deletions

View File

@@ -10,10 +10,11 @@ import (
// Destriping multisensor imagery with moment matching [Gadallah, 2000]
func DoMomentMatching(originalImg gocv.Mat) {
probes := originalImg.Cols()
log.Printf("do moment matching for %d probes", probes)
log.Printf("do moment matching for %d probes, %d rows", probes, originalImg.Rows())
// 第i个探元的像元均值和标准差
means := make([]float64, probes)
stds := make([]float64, probes)
// 计算每个探元的均值和标准差
for x := 0; x < originalImg.Cols(); x++ {
var total int64
@@ -34,16 +35,17 @@ func DoMomentMatching(originalImg gocv.Mat) {
}
// 列参考值和列参考标准差
var mu float64
var sig float64
var mu, sig float64
for x := 0; x < probes; x++ {
mu += means[x]
sig += stds[x]
}
mu = mu / float64(probes)
sig = sig / float64(probes)
log.Printf("mean reference value: %f, std reference value: %f", mu, sig)
// 修正 DN_adjusted[i] = (DN[i] - means[i]) *sig/stds[i]+mu
for x := 0; x < originalImg.Cols(); x++ {
for y := 0; y < originalImg.Rows(); y++ {