gpt4 book ai didi

python - Python 中 correlate2d 的模块

转载 作者:太空宇宙 更新时间:2023-11-04 06:05:48 27 4
gpt4 key购买 nike

我想使用 correlate2d 计算两个矩阵之间的相关性(代码:corr = correlate2d(im, im, fft = True))。

correlate2d 是 scipy 的一部分,现在在 stsci_python 下.

目前我加载模块如下:

import scipy
from scipy import *
import numpy as np
import stsci
from stsci import *

我收到错误 name 'correlate2d' is not defined。我需要为此加载哪些模块?

最佳答案

SciPy 的信号子包中有correlate2d:

import scipy.signal

其次是:

corr = scipy.signal.correlate2d(matrix1,matrix2)

SciPy子包需要单独导入; stsci可能是一样的。

-奥尔多

关于python - Python 中 correlate2d 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22168340/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com