经过霍夫变换的直线所得的角度为什么不能直接用数字去减
-
zj = 90 pj = 180 if jdc > zj: jdc = pj - jdc
-
@1qx5 为什么if判断不能用
-
为什么用if会报错呢
-
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
-
@kidswong999 错误提示是无效语法
-
请提供全部代码,可以复现错误的代码。
-
enable_lens_corr = False # turn on for straighter lines... import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() min_degree = 0 max_degree = 179 while(True): clock.tick() img = sensor.snapshot() if enable_lens_corr: img.lens_corr(1.8) # for 2.8mm lens... for l in img.find_lines(threshold = 1000, theta_margin = 30, rho_margin = 30): if (min_degree <= l.theta()) and (l.theta() <= max_degree): img.draw_line(l.line(), color = (255, 0, 0)) print(l) jdc =0 jdc1 =0 jdc2 =0 lines = img.find_lines() if len(lines) == 3: jd1 = lines[0].theta() jd2 = lines[1].theta() jd3 = lines[2].theta() jdc = jd1 - jd2 jdc1 = jd3 - jd2 jdc2 = jd1 - jd3 print(jdc) print(jdc1) print(jdc2) zj = 90 pj = 180 if jdc > zj: jdc = 180 - jdc print(jdc) print("FPS %f" % clock.fps())
-
if下一行没有缩进。
-
@kidswong999 。。。感谢