嘿,我在使用掩码向矩阵添加标量时遇到错误TypeError: mask is not a numerical tuple
。mask变量在这里打印:
(15.0, array([[ 0, 255, 0, ..., 0, 0, 0],
[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 255, ..., 0, 0, 0],
...,
[255, 255, 255, ..., 0, 0, 0],
[255, 255, 255, ..., 0, 0, 0],
[ 0, 255, 255, ..., 0, 0, 0]], dtype=uint8))
这就是错误本身:
Traceback (most recent call last):
File "/home/clime/mrak/motionpaint/motion_painter.py", line 97, in process_frame
self.alphas = cv2.add(self.alphas, self.alpha_increment, mask=mask)
TypeError: mask is not a numerical tuple
我就是这样得到面具的:
diff = cv2.absdiff(self.prevFrame, smoothedFrame)
# convert difference to grayscale.
greyDiff = cv2.cvtColor(diff, cv2.COLOR_RGB2GRAY)
# grayscale to black and white (i.e. false and true)
mask = cv2.threshold(greyDiff, self.threshold, 255, cv2.THRESH_BINARY)
目前没有回答
相关问题 更多 >
编程相关推荐