A
aucy
@aucy
0
声望
3
楼层
468
资料浏览
0
粉丝
0
关注
aucy 发布的帖子
-
调用find_line函数之后,打印返回image.line的对象列表会报错,携带源码和报错图片,help
# Single Color RGB565 Blob Tracking Example # # This example shows off single color RGB565 tracking using the OpenMV Cam. import sensor, image, time, math threshold_index = 0 # 0 for red, 1 for green, 2 for blue # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max) # The below thresholds track in general red/green/blue things. You may wish to tune them... sb = (8, 21, -36, 9, -11, 17) ng=(29, 81, 30, 80, 30, 80)# generic_green_thresholds THRESHOLD=(70, 0, -128, 127, -128, 127) sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # camera resolution. "merge=True" merges all overlapping blobs in the image. while(True): clock.tick() img = sensor.snapshot() blobsb=img.find_blobs([sb], pixels_threshold=200, area_threshold=200) blobng=img.find_blobs([ng], pixels_threshold=200, area_threshold=200) if blobsb or blobng: for s in blobsb: img.draw_cross(s.cx(), s.cy()) #img.draw_rectangle(s.rect()) for blobn in blobng: img.draw_cross(blobn.cx(), blobn.cy()) #img.draw_rectangle(blobn.rect()) img.draw_line(s.cx(), s.cy(),blobn.cx(), blobn.cy(), color = [0, 0, 255]) #img.binary([THRESHOLD]) line=img.find_line_segments() if (line): rho_err = abs(line.rho())-img.width()/2 if line.theta()>90: theta_err = line.theta()-180 else: theta_err = line.theta() img.draw_line(line.line(), color = 127) print(line.theta()) # Note - the blob rotation is unique to 0-180 only. #img.draw_keypoints([(blob.cx(), blob.cy(), int(math.degrees(blob.rotation())))], size=20)
-
请问各位大佬,在使用img.draw_line函数绘制直线之后,可否调用其他函数对该绘制的图线进行处理。
请问各位大佬,在使用img.draw_line函数绘制直线之后,可否调用其他函数对该绘制的图线进行处理。