openmv无法更新程序,有可能是什么问题呢?具体表现为:在IDE中可以运行程序,也能成功保存,一旦掉电后重新裸机运行,就是默认程序,打开H盘的main.py也是默认的程序
1
18852865532
@18852865532
0
声望
14
楼层
727
资料浏览
0
粉丝
0
关注
18852865532 发布的帖子
-
openmv无法更新程序
-
在验证模板匹配时出现这样的报错,怎么解决呢?
# image patches to parts of an image... expect for extremely controlled enviorments # NCC is not all to useful. # # WARNING: NCC supports needs to be reworked! As of right now this feature needs # a lot of work to be made into somethin useful. This script will reamin to show # that the functionality exists, but, in its current state is inadequate. import time, sensor, image from image import SEARCH_EX, SEARCH_DS # Reset sensor sensor.reset() # Set sensor settings sensor.set_contrast(1) sensor.set_gainceiling(16) # Max resolution for template matching with SEARCH_EX is QQVGA sensor.set_framesize(sensor.QQVGA) # You can set windowing to reduce the search image. #sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60)) sensor.set_pixformat(sensor.GRAYSCALE) # Load template. # Template should be a small (eg. 32x32 pixels) grayscale image. template = image.Image("/1.pgm") clock = time.clock() # Run template matching while (True): clock.tick() img = sensor.snapshot() # find_template(template, threshold, [roi, step, search]) # ROI: The region of interest tuple (x, y, w, h). # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster. # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search # # Note1: ROI has to be smaller than the image and bigger than the template. # Note2: In diamond search, step and ROI are both ignored. r = img.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60)) if r: img.draw_rectangle(r) print(clock.fps())
-
关于openmv卡死的问题
你好,我在进行颜色识别的过程中发现openmv会不时卡住,请问这是什么原因呢?自己猜想,是不是跟自己在同个图像中进行了两次分区域识别有关,希望有知道的大佬指点一下,另外,在卡住之后图像会直接与摄像头断开连接,这个问题非常致命!
import sensor, image, time,math from pyb import UART import json sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # use RGB565. sensor.set_framesize(sensor.QQVGA) # use QVGA for quailtiy ,use QQVGA for speed. sensor.skip_frames(10) # Let new settings take affect. #sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) sensor.set_vflip(True) clock = time.clock() # Tracks FPS. #初始化 uart = UART(3, 115200) color_threshold1 = (0, 255, -40, -20, 10, 35) color_threshold2 = (0, 255, -40, -20, 10, 35) date1=0 date2=100 while(True): flag1=1 flag2=0 clock.tick() # Track elapsed milliseconds between snapshots(). img = sensor.snapshot() # Take a picture and return the image. #查看是否检测到了绿色基座 blobs = img.find_blobs([color_threshold1],roi=[40,60,80,60], area_threshold=300) if blobs: #如果找到了目标颜色 for blob in blobs: #迭代找到的目标颜色区域 is_rect = 0 rect_s=0 max_s = -1 for c in img.find_rects(): is_rect = 1 rect_s=c.y()*c.h() if rect_s > max_s: max_s = rect_s max_rect = c if is_rect: flag2=1 img.draw_rectangle(blob.rect()) # rect # 如果有对应颜色的矩形 标记外框 img.draw_cross(blob[5], blob[6]) # cx, cy 画出十字 date1=int(blob.cx()-80) #查看是否检测到了水稻 blobs=img.find_blobs([color_threshold2],roi=[40,0,80,60],x_stride=10,y_stride=10,area_threshold=500,merge=True,pixels_threshold=50) if blobs: flag1=0 max_blob=-1 mblob=0 for blob in blobs: if blob.area()>max_blob: mblob=blob img.draw_rectangle(mblob.rect()) # rect if (flag1 and flag2): date=bytearray([0xDD,date1,0XDF]) print(date1) #uart.write(date) flag1=1 flag2=0 else: date=bytearray([0xDD,date2,0XDF]) print(date2) #uart.write(date) flag1=1 flag2=0 #print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
-
openmv什么时候可以使用VGA模式?
我在把颜色识别和形状识别结合在一起的时候,发现可能是像素点太少的缘故,当距离较远或者角度不正的时候,会识别失败,所以想把QQVGA换成VGA,但是它会报错如下,有人知道怎么才能使用VGA模式吗?我用的7725v3和stm32H7芯片,所以不用担心处理速度的问题。
import sensor, image, time color_threshold1 = (0, 255, 40, 80, 40, 70) color_threshold2 = (0, 130, 40, 80, 40, 70) sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # use RGB565. sensor.set_framesize(sensor.QQVGA) # use QVGA for quailtiy ,use QQVGA for speed. sensor.skip_frames(10) # Let new settings take affect. sensor.set_auto_whitebal(False) #关闭白平衡。白平衡是默认开启的,在颜色识别中,需要关闭白平衡。 clock = time.clock() # Tracks FPS. #扩宽roi def expand_roi(roi): # set for QQVGA 160*120 extra = 5 win_size = (160, 120) (x, y, width, height) = roi new_roi = [x-extra, y-extra, width+2*extra, height+2*extra] if new_roi[0] < 0: new_roi[0] = 0 if new_roi[1] < 0: new_roi[1] = 0 if new_roi[2] > win_size[0]: new_roi[2] = win_size[0] if new_roi[3] > win_size[1]: new_roi[3] = win_size[1] return tuple(new_roi) while(True): clock.tick() # Track elapsed milliseconds between snapshots(). img = sensor.snapshot() # Take a picture and return the image. # pixels_threshold=100, area_threshold=100 blobs = img.find_blobs([color_threshold1], area_threshold=150) if blobs: #如果找到了目标颜色 print(blobs) for blob in blobs: #迭代找到的目标颜色区域 is_rect = 0 rect_s=0 max_s = -1 new_roi = expand_roi(blob.rect()) for c in img.find_rects(): is_rect = 1 rect_s=c.y()*c.h() # img.draw_rectangle(x,y,w,h [,color[,thickness=1[,fill=False]]]) if rect_s > max_s: max_s = rect_s max_rect = c if is_rect: # 如果有对应颜色的矩形 标记外框 img.draw_rectangle(new_roi) # rect img.draw_rectangle(blob.rect()) # rect #用矩形标记出目标颜色区域 img.draw_cross(blob[5], blob[6]) # cx, cy img.draw_rectangle(max_rect.x(), max_rect.y(), max_rect.w(), max_rect.h(),color = (0, 255, 0)) img.draw_rectangle(max_rect.x()-1, max_rect.y()-1, max_rect.w()+2, max_rect.h()+2,color = (0, 255, 0)) print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while # connected to your computer. The FPS should increase once disconnected. ![0_1563880779720_1.PNG](https://fcdn.singtown.com/55dd819e-826d-4e91-a4ac-083e8576c64b.PNG)
-
如何减少颜色识别时不同光照条件带来的影响
之前在使用openMv的时候就发现,不同光照条件对颜色识别的影响很大,所以我在减少光照对颜色识别的影响的方法,望知道的高手指点一下,目前准备用ov7725V3和stm32h7来运行