You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Perlin噪声2D功率谱估计:scale增大时分辨率缩小问题求助

2D Perlin噪声功率谱估计(Bartlett方法)的分辨率问题

目标

我正在尝试为Perlin噪声生成2D功率谱估计,目标是复刻《Survey Procedural Noise》第15页第(4)行最左侧的Perlin噪声功率谱估计图像。

问题描述

当增大Perlin噪声的scale(提升0-1区间数值的分辨率/细节)时,即便噪声本身和单个周期图的分辨率随scale提升,采用Bartlett's method得到的功率谱估计分辨率仍会降低。

  • Perlin噪声受scale影响的示例(分辨率设为100以凸显效果):Scale 2、Scale 8、Scale 32
  • 功率谱估计“缩小”的示例:
    • Scale 2 - 分辨率800 - 周期图数量16
    • Scale 8 - 分辨率3200 - 周期图数量16
    • Scale 32 - 分辨率12800 - 周期图数量16

我猜测可能与fft2d有关,但完全不清楚原因。(注:实际计算时我会使用更高分辨率,且偏好scale=32)

实现代码

周期图计算函数

import numpy as np

def compute_periodogram(noise):
    fft_result = np.fft.fft2(noise)
    fft_shifted = np.fft.fftshift(fft_result)
    power_spectrum = np.abs(fft_shifted)**2

    return power_spectrum

2D Bartlett功率谱估计函数

# Computes Bartlett's power spectrum estimation for a 2D signal (assumes the 2D signal is a square)
def bartlett_2d(signal, k):
    periodograms = []

    k_1d = int(np.sqrt(k)) # Makes k (the number of subsections) 1D
    m = int(len(signal)/k) # Length of each subsection of the signal

    # Divides the signal into subsections and computes a peridogram for each subsection
    for y in range(k_1d):
        for x in range(k_1d):
            # `slice_2d` returns a slice of a 2d array (matrix, x_slice[start, end], y_slice[start, end])
            subsection = slice_2d(signal, (m*x, m*(x+1)-1),  (m*y, m*(y+1)-1))
            periodograms.append(compute_periodogram(subsection))
    
    # Averages peridograms
    power_spectrum = np.zeros((m, m))

    for pdg in periodograms:
        power_spectrum += pdg
    
    return power_spectrum / k

求助

恳请各位提供问题排查、优化建议或更好的解决方案,感谢帮助。


内容的提问来源于stack exchange,提问作者Nov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 00:29:59