@kidswong999 是啊 在你们淘宝店铺买了俩块顶配
F
fc3i
@fc3i
0
声望
7
楼层
508
资料浏览
0
粉丝
0
关注
fc3i 发布的帖子
-
RE: 选择兴趣区然后大概率会报错 是什么原因啊报错内容如下
@kidswong999 在 选择兴趣区然后大概率会报错 是什么原因啊报错内容如下 中说:
是OpenMV4 h7 Plus
-
RE: 选择兴趣区然后大概率会报错 是什么原因啊报错内容如下
THRESHOLD =(79, 93, -24, 16, -19, 22) THRESHOLD1 =(77, 94, -22, 18, -15, 17) THRESHOLDG = (56, 78, -31, 1, -19, 25) THRESHOLDB = (43, 71, -10, 20, -52, -9) THRESHOLDR = (38, 67, 5, 41, -26, 24) GRAYSCALE_THRESHOLD = (240, 255) GRAYSCALE_THRESHOLD1 = (117, 86) # Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script! xingzhuang=0 import sensor, image, time,json,pyb,math,cpufreq from pyb import LED,UART,Pin,Timer from image import SEARCH_EX, SEARCH_DS roi_x=0 roi_y=0 roi_w=0 roi_h=0 uart = UART(3, 9600,timeout_char = 0) sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.FHD) # Set frame size to QVGA (320x240) sensor.skip_frames(time = 1900) # Wait for settings take effect. clock = time.clock() # Create a clock object to track the FPS. sensor.set_vflip(True) sensor.set_hmirror(True) img = sensor.snapshot() #pyb.delay(600) blobs = img.find_blobs([THRESHOLD],pixels_threshold=200000, area_threshold=5000,merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: img.draw_rectangle(blobs[0].rect(),color=(0,0,255)) img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(0,0,255)) a=blobs[0].x()+8 b=blobs[0].y()+8 c=blobs[0].w()-20 d=blobs[0].h()-28 print('白色',a,b,c,d) sensor.set_windowing((a,b,c,d)) #sensor.set_windowing((206,103,180,240)) #取中间的640*80区域 #print('cpu:',cpufreq.get_current_frequencies()) while(True): clock.tick() #pyb.delay(900) img = sensor.snapshot() print(clock.fps()) sum = 0 for l in img.find_line_segments(merge_distance = 250, max_theta_diff = 20): #area = (l.x1(),l.y2(),l.x2()-l.x1(),l.y2()-l.y1()) #statistics = img.get_statistics(roi=area) #img.draw_line(l.line(),color = (255,0,0)) #img.draw_cross(l.x1(),l.y1(),color=(255,0,0)) #img.draw_cross(l.x2(),l.y2(),color=(255,0,0)) sum += l.theta() sum-=90 print(sum) if sum < 200 and sum >160: print('三角形') xingzhuang=1 if sum >70 and sum <120: print('正方形') xingzhuang=2 if sum >380: print('圆形') xingzhuang=3 roi_x=0 roi_y=0 roi_w=0 roi_h=0 yanse=0 blobs = img.find_blobs([THRESHOLDB],pixels_threshold=1000, area_threshold=600,merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: img.draw_rectangle(blobs[0].rect(),color=(0,0,255)) #img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(0,0,255)) print('蓝色') roi_x=blobs[0].x() roi_y=blobs[0].y() roi_w=blobs[0].w() roi_h=blobs[0].h() yanse=1 m=blobs[0].pixels() print('像素数:',m) #img.binary([THRESHOLDB],invert=True) #img.erode(3) #img.dilate(4) pyb.delay(6) blobs = img.find_blobs([THRESHOLDR],pixels_threshold=200, area_threshold=20,merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: #img.draw_rectangle(blobs[0].rect(),color=(255,0,0)) #img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(255,0,0)) print('红色') roi_x=blobs[0].x() roi_y=blobs[0].y() roi_w=blobs[0].w() roi_h=blobs[0].h() yanse=2 m=blobs[0].pixels() print('像素数:',m) pyb.delay(6) blobs = img.find_blobs([THRESHOLDG],pixels_threshold=2000, area_threshold=200,merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: #img.draw_rectangle(blobs[0].rect(),color=(0,255,0)) #img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(0,255,0)) roi_x=blobs[0].x() roi_y=blobs[0].y() roi_w=blobs[0].w() roi_h=blobs[0].h() print('绿色') yanse=3 #img.binary([THRESHOLDG],invert=True) m=blobs[0].pixels() print('像素数:',m) pyb.delay(6) if xingzhuang==3: blobs = img.find_blobs([THRESHOLD1],pixels_threshold=20000, area_threshold=2000,roi=(roi_x,roi_y,roi_w,roi_h),merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: img.draw_rectangle(blobs[0].rect(),color=(255,255,255)) img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(255,255,255)) kuandu=(roi_w-blobs[0].w())/2*(210/(c+20)) print('宽度:',kuandu,'mm') juli=math.sqrt(pow(blobs[0].cx(),2)+pow(blobs[0].cy(),2))*(210/(c-10)) print('圆心距离左上角:',juli,'mm') pyb.delay(6) if xingzhuang==2: blobs = img.find_blobs([THRESHOLD1],pixels_threshold=20000, area_threshold=2000,roi=(roi_x,roi_y,roi_w,roi_h),merge=False) # to the IDE. The FPS should increase once disconnected. if blobs: img.draw_rectangle(blobs[0].rect(),color=(255,255,255)) img.draw_cross(blobs[0].cx(),blobs[0].cy(),color=(255,255,255)) kuandu=(roi_w-blobs[0].w())/2*(210/(c+20)) gaodu=(roi_h-blobs[0].h())/2*(210/(c+20)) xiankuan=(kuandu+gaodu)/2 kuandu1=(roi_w+blobs[0].w())/2*(210/(c+20)) gaodu1=(roi_h+blobs[0].h())/2*(210/(c+20)) print('宽度:',kuandu1,'mm') print('高度:',gaodu1,'mm') data=[] data.append((xingzhuang,yanse,int(xiankuan),int(kuandu1),int(gaodu1),0)) data_out = json.dumps(set(data)) uart.write(data_out +'\n') print('you send:',data_out) pyb.delay(6) if xingzhuang==1: cishu=0 zhouchang=0 xianchang=[0,0,0,0,0,0,0,0] for l in img.find_line_segments(merge_distance = 20000, max_theta_diff = 20): img.draw_line(l.line(),color = (255,0,0)) changdu=l.length()*(210/(c-25)) print('长度',cishu,':',changdu) xianchang[cishu]=changdu cishu=cishu+1 zhouchang=changdu+zhouchang if cishu==3: print('周长:',zhouchang) xiankuan=(m*((210/(c-20))*(210/(c-20))))/zhouchang print('线宽:',xiankuan) data=[] #data.append((xingzhuang,yanse,int(zhouchang),int(xiankuan))) data.append((xingzhuang,yanse,int(xiankuan),int(xianchang[0]),int(xianchang[1]),int(xianchang[2]))) data_out = json.dumps(set(data)) uart.write(data_out +'\n') print('you send:',data_out) pyb.delay(6) xingzhuang=0 m=0
-
RE: 怎么用openmv控制激光云台寻曲线啊完全没思路啊/(ㄒoㄒ)/~~
@fc3i 基础部分
1、设计云台系统控制激光灯,在距离至少2米远竖直的A4大小(210mm×297mm)的纯白平面上任意移动(手动控制)。
2、设计形状识别系统可以识别A4打印纸上的矩形、三角形、圆形及颜色,并测量相关的参数,其中矩形和三角形要测量各边的线宽 、线长;圆形需要测量线宽、半径及圆心相对A4纸左上角的坐标。线宽范围2mm-10mm。线的颜色为红、蓝、绿。相机轴线正负30度为有效测量角度,并与A4平面至少2米不超过三米。发挥部分
1、通过云台控制激光灯能跟踪A4纸上的任意曲线。曲线线宽8mm线宽,不交叉,不限速。跟踪误差在线宽范围内。
2、可以设定并显示跟踪速度。
3、曲线有交叉,环岛与交叉(交叉角度在0-90度)。
这个是题目