Openmv运行几秒卡住不动,固件已经升级到最新了
-
Openmv运行几秒卡住不动,固件已经升级到最新了
-
先测试hello world,
卡住不动是什么意思?具体的截图发一下。
-
右侧lab值一点都不变了,动都动不了,换了一个openmv,结果输出几下然后也卡住不动了,镜头不动,lab的阈值也不动,输出也没有
-
提供
1,全屏的截图,
2,具体的代码。
3,固件版本,和硬件是什么。
-
import sensor, image, time import json from image import SEARCH_EX, SEARCH_DS from pyb import UART uart = UART(3, 9600) red_threshold = ((18, 59, 15, 50, 2, 42));#第一步!!!!中点坐标 blue_threshold = (((10, 55, -15, 16, -40, -6))); sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) 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() while(True): #zifu = uart.readchar() #if(zifu == 3): zifu = '' circlefalg = 0 rectflag = 0 sum=0 bb=0 j=0 a = {} SANY=45 SANYH=55 SANX=100 SANXW=110 A = 0 b = 0 z = 0x00 k = 0x00 j = 0x00 img = sensor.snapshot().lens_corr(1.8) blob1 = img.find_blobs([red_threshold],roi=(10,1,111,112),pixels_threshold=300) blob2 = img.find_blobs([blue_threshold],roi=(10,1,111,112),pixels_threshold=300) clock.tick() while(j<3): for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10, r_min = 20, r_max =100 , r_step = 2): circleflag = 1 area1 = (c.x()-c.r(), c.y()-c.r(), 2*c.r(), 2*c.r()) z = 0x01 statistics = img.get_statistics(roi=area1)#像素颜色统计 if 18<statistics.l_mode()<59 and 15<statistics.a_mode()<50 and 2<statistics.b_mode()<42: img.draw_circle(c.x(), c.y(), c.r(), color = (0, 255, 0)) A=1 elif 10<statistics.l_mode()<55 and -15<statistics.a_mode()<16 and -40<statistics.b_mode()<-6: img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0)) A=2 for r in img.find_rects(threshold = 10000): rectflag = 1 area2 = (r.rect()) statistics = img.get_statistics(roi=area2) j = 0x01 if 18<statistics.l_mode()<59 and 15<statistics.a_mode()<50 and 2<statistics.b_mode()<42: img.draw_rectangle(area2, color = (0, 255, 0)) A=3 elif 10<statistics.l_mode()<55 and -15<statistics.a_mode()<16 and -40<statistics.b_mode()<-6: img.draw_rectangle(area2, color = (255, 0, 0)) A=4 if z != 0x01 and j != 0x01: #红色 if blob1: A=5 if blob2: #蓝色 A=6 j = j+1 b = b+A if(b == A*3 and b != 0): print(c) if(A == 1): uart.write('1') elif(A == 2): uart.write('2') elif(A == 3): uart.write('3') elif(A == 4): uart.write('4') elif(A == 5): uart.write('5') elif(A == 6): uart.write('6')
硬件是::::Traceback (most recent call last):
File "", line 12, in
Exception: IDE interrupt
MicroPython: v1.15-r32 OpenMV: v4.0.2 HAL: v1.9.0 BOARD: OPENMV4P-STM32H743
Type "help()" for more information.
-
@kidswong999 还需要什么,我全都发出来
-
你这明显代码有问题,你可以打印j,我测试永远是2
-
@kidswong999 大佬。真的不知道咋改,开头两次循环J还正常,后面全都变2了,在大循环While(True)中,我已经赋值给J=0了啊,求助了
-
你的代码肯定要自己改,我又不知道你要做什么,你代码写的我看不懂。