|

楼主 |
发表于 2023-5-11 19:12:32
|
显示全部楼层
openmv端
uart = UART(3,115200)
uart.init(115200, bits=8, parity=None, stop=1)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
# detect() returns all objects found in the image (splitted out per class already)
# we skip class index 0, as that is the background, and then draw circles of the center
# of our objects
for i, detection_list in enumerate(net.detect(img, thresholds=[(math.ceil(min_confidence * 255), 255)])):
if (i == 0): continue # background class
if (len(detection_list) == 0): continue # no detections for this class?
print("********** %s **********" % labels[i])
if labels[i] == "l" :
OBJ=1
print("左转")
if labels[i] == "r" :
OBJ=2
print("右转")
if labels[i] == "s" :
OBJ=3
print("直走")
uart_data=sbz_format(OBJ)
uart.write(uart_data)
print(uart_data)
print("%d" % OBJ)
|
|