ndarray使用 pydantic 时如何初始化?
这段代码抛出一个ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
from pydantic.dataclasses import dataclass
import numpy as np
@dataclass
class TestNumpyArray:
numpyArray: np.ndarray = np.zeros(10)
testNumpyArray = TestNumpyArray()
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 w10、python 3.6、opencv2 查找 aruco 标记。
我可以检测到标记,但在这一步失败
rvec, tvec = aruco.estimatePoseSingleMarkers(corners, markerLength, camera_matrix, dist_coeffs) # For a single marker
Run Code Online (Sandbox Code Playgroud)
我得到这个 python 异常:
ValueError: too many values to unpack (expected 2)
Run Code Online (Sandbox Code Playgroud)
在结果列表中省略 tvec 不会引发错误,但我没有翻译信息。