gpt4 book ai didi

python-2.7 - openPIV示例代码错误

转载 作者:行者123 更新时间:2023-12-04 01:08:05 25 4
gpt4 key购买 nike

我正在研究 openPIV 的示例代码。版本是最新的(openpiv-python-master)。我得到一个错误;AttributeError:“模块”对象没有属性“验证”虽然我设置了路径,但是openPIV好像找不到validation.py。你能告诉我如何解决吗?

import openpiv.tools
import openpiv.process
import openpiv.scaling
import numpy as np
import sys
sys.path.append('/Users/myname/openpiv-python-master/openpiv')

filedir = '/Users/myname/tutorial-part1/'
frame_a = openpiv.tools.imread( filedir + 'exp1_001_a.bmp' )
frame_b = openpiv.tools.imread( filedir + 'exp1_001_b.bmp' )

u, v, sig2noise = openpiv.process.extended_search_area_piv( frame_a.astype(np.int32), frame_b.astype(np.int32), window_size=24, overlap=12, dt=0.02, search_area_size=64, sig2noise_method='peak2peak' )
x, y = openpiv.process.get_coordinates( image_size=frame_a.shape, window_size=24, overlap=12 )
u, v, mask = openpiv.validation.sig2noise_val( u, v, sig2noise, threshold = 1.3 )
u, v = openpiv.filters.replace_outliers( u, v, method='localmean', max_iter=10, kernel_size=2)
x, y, u, v = openpiv.scaling.uniform(x, y, u, v, scaling_factor = 96.52 )
openpiv.tools.save(x, y, u, v, mask, 'exp1_001.txt' )
openpiv.tools.display_vector_field('exp1_001.txt', scale=100, width=0.0025)

最佳答案

我有同样的错误。您只需要在示例代码中导入它。只需添加这些行。

import openpiv.validation
import openpiv.filters

关于python-2.7 - openPIV示例代码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44193557/

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