例程讲解-09-linear_regression_fast 快速线性回归(巡线),返回的line.theta()的角度坐标轴是怎样的呢?是和水平线逆时针的角度吗
G
gtf5
@gtf5
0
声望
7
楼层
200
资料浏览
0
粉丝
0
关注
gtf5 发布的帖子
-
快速线性回归(巡线)返回的theta
-
笑脸识别没找到相应的神经网络文件
例程讲解25-Machine-Learning->nnn_haar_smile_detection
我想运行这个例程,但是‘’运行此例程前,请先在OpenMV IDE->工具->机器视觉->CNN网络库 中,将相应的神经网络文件保存到OpenMV的SD内存卡中哦‘’时,没找到相应的神经网络文件
-
openmv判断两直线是否相交
#通过检测两直线是否相交判断十字路口 import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) line_threshold = (30, 100) noc = 0 #number of crossroad while True: img = sensor.snapshot().binary([line_threshold]) # 检测直线 lines = img.find_lines(threshold = 1000, theta_margin = 25, rho_margin = 25) for line in lines: img.draw_line(line.line(), color=127) # 检测十字 cross_detected = False for i in range(len(lines)): for j in range(i+1, len(lines)): if abs(lines[i].theta() - lines[j].theta()) < 30: continue intersection = lines[i].intersection(lines[j]) if intersection: x, y = int(intersection.x()), int(intersection.y()) img.draw_cross(x, y) cross_detected = True noc = noc+1 # 输出是否检测到十字 print("Cross detected: ", cross_detected) print(noc)
提示AttributeError: ‘line’ object has no attribute ‘intersection’
光标位置intersection = lines[i].intersection(lines[j])
openmv里有没有类似intersection()获取交叉点的方法呢 -
RE: openmv进行十字路口检测,判断两直线是否相交
准确的说光标定位在img = sensor.snapshot().binary(line_threshold)的后面
-
openmv进行十字路口检测,判断两直线是否相交
为什么会提示TypeError: object ‘int’ isn’t a tuple or list
提示错误的时候光标定位在img = sensor.snapshot().binary(line_threshold)import sensor, image # 初始化摄像头 sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) line_threshold = (30, 100) while True: img = sensor.snapshot().binary(line_threshold) # 检测直线 lines = img.find_lines(threshold = 1000, theta_margin = 25, rho_margin = 25) for line in lines: img.draw_line(line.line(), color=127) # 检测十字 cross_detected = False for i in range(len(lines)): for j in range(i+1, len(lines)): if abs(lines[i].theta() - lines[j].theta()) < 30: continue intersection = lines[i].intersection(lines[j]) if intersection: x, y = int(intersection.x()), int(intersection.y()) img.draw_cross(x, y) cross_detected = True # 输出是否检测到十字 print("Cross detected: ", cross_detected)