python 运行时警告和绘图轴的更改

rsaldnfx  于 2023-08-02  发布在  Python
关注(0)|答案(1)|浏览(114)
min_width = (min(widths_in_frame) * 0.00633217993)
log_val = np.log(min_width/1.8)
widths.append(log_val)
frames.append(cap.get(cv2.CAP_PROP_POS_FRAMES))

个字符
我在这里得到这个警告,我的框架轴缩小(从1600到1400)

egdjgwm8

egdjgwm81#

该错误的原因是,在计算(min(widths_in_frame) * 0.00633217993)之后,min_width以某种方式变为等于0或非常接近0,因此不可能计算min_width/1.8
为了找出问题来自哪个阶段,您可以使用min_width之前和之后的一些打印,例如:

print(f"widths_in_frame = {widths_in_frame}")
print(f"min(widths_in_frame) = {min(widths_in_frame)}")

min_width = (min(widths_in_frame) * 0.00633217993)

print(f"min_width = {min_width}")

字符串

相关问题