导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 搜索

    高级搜索

    搜索子版块
    保存设置 清除设置
    共 499 条结果匹配 "sensor",(耗时 0.02 秒)

    如何让flag=1,1时 蜂鸣器每隔5秒响一秒 不用延时函数

    在死循环里判断一下时间。

    import sensor, image, time
    import pyb
    sensor.reset()
    sensor.set_pixformat(sensor.RGB565)
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(time = 2000)
    
    clock = time.clock()
    
    flag = True
    while(True):
        if flag:
            sec = pyb.millis()//1000 % 6
            if sec == 0:
                print("响")
            else:
                print("不响")
        clock.tick()
        img = sensor.snapshot()
    
        
    
    

    发布在 OpenMV Cam

    有关视频录制的问题

    我想让智能车运动的时候顺便录制视频,可每次视
    频录制完了车子也会停下来,怎么才能使视频录制完之后车子保持运动?

    import sensor, image, time, mjpeg, pyb, car
    
    RED_LED_PIN = 1
    BLUE_LED_PIN = 3
    
    sensor.reset() # Initialize the camera sensor.
    sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
    sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
    sensor.skip_frames(10) # Let new settings take affect.
    clock = time.clock() # Tracks FPS.
    
    pyb.LED(RED_LED_PIN).on()
    sensor.skip_frames(30) # Give the user time to get ready.
    pyb.LED(RED_LED_PIN).off()
    
    
    pyb.LED(BLUE_LED_PIN).on()
    m = mjpeg.Mjpeg("example.mjpeg")
    
    for i in range(200):
        clock.tick()
        m.add_frame(sensor.snapshot())
        print(clock.fps())
    m.close(clock.fps())
    pyb.LED(BLUE_LED_PIN).off()
    
    car.run(100,100)
    

    F
    发布在 OpenMV Cam

    颜色过去以后会出现好几遍这个颜色,能不能只出现一次

    颜色过去以后会出现好几遍这个颜色,能不能只出现一次

    import sensor, image,time,pyb,utime
    import sensor, image, time,utime
    from pyb import UART
    uart = UART(3, 57600)
    output_str=0
    yanse=0
    flag=1
    while 1:
      if uart.any():
    	 flag=uart.readline().decode()
    	 flag=int(flag)
    	 print(flag)
      if flag==1:
    		 thresholds = [(60, 18, 37, 75, -35, 76),(58, 24, -11, 17, -61, -16),(60, 30, -17, -58, -43, 31)]
    		 sensor.reset()
    		 sensor.set_pixformat(sensor.RGB565)
    		 sensor.set_framesize(sensor.QVGA)
    		 sensor.skip_frames(time = 2000)
    		 sensor.set_auto_gain(False)
    		 sensor.set_auto_whitebal(False)
    		 while flag :
    			img = sensor.snapshot()
    			blobs=img.find_blobs(thresholds, pixels_threshold=5000, area_threshold=400)
    			for blob in blobs:
    			  img.draw_rectangle(blob.rect())
    			  img.draw_cross(blob.cx(), blob.cy())
    			  yanse="%s" % (blob.code())
    			  print( yanse)
    			  if  yanse:
    				 uart.write(yanse)
    				 yanse=0
    

    L
    发布在 OpenMV Cam

    定时器调用出现报错,IDE获取的画面停止,模块与电脑断开

    之前发现这个问题,但是没得到解决

    
    import sensor, image, time
    from pyb import Pin, Timer
    
    sensor.reset()                      # Reset and initialize the sensor.
    sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
    sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
    sensor.skip_frames(time = 2000)     # Wait for settings take effect.
    
    RUN = LED(4)
    clock = time.clock()                # Create a clock object to track the FPS.
    def tick(timer):            # we will receive the timer object when being called
        RUN.toggle()
        
    tim = Timer(4, freq=1)      # create a timer object using timer 4 - trigger at 1Hz
    tim.callback(tick)          # set the callback to our tick function
    
    
    while(True):
        img = sensor.snapshot()         # Take a picture and return the image.
                                        # to the IDE. The FPS should increase once disconnected.
    

    C
    发布在 OpenMV Cam

    模板匹配(插了内存卡) MmemoryError:Out of fast Frame Buffer Stack

    ![0_1570763155002_微信截图_20191011110325.png](https://fcdn.singtown.com/255f19ca-35d0-

    import sensor, image, time
    from image import SEARCH_EX, SEARCH_DS
    
    
    # Set sensor settings
    #sensor.set_contrast(1)
    #sensor.set_gainceiling(16)
    
    sensor.reset()
    sensor.set_pixformat(sensor.RGB565)
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(time = 2000)
    
    
    
    
    # Load template.
    # Template should be a small (eg. 32x32 pixels) grayscale image.
    template = image.Image("/template.pgm")
    
    
    
    clock = time.clock()
    
    while(True):
        clock.tick()
        img = sensor.snapshot()
        
        if img.format() != sensor.GRAYSCALE:
            imge = img.to_grayscale()  #默认False , True内存溢出
            r = imge.find_template(template, 0.70, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
            if r:
                img.draw_rectangle(r,color = (0, 0, 0), thickness = 1, fill = False)
            else:
                ROI_X=50
                ROI_Y=13
                ROI_W=60
                ROI_H=80 
                ROI=(ROI_X,ROI_Y,ROI_W ,ROI_H) 
                img.draw_rectangle(ROI,color = (0, 0, 0), thickness = 1, fill = False)
            
        print(clock.fps())
    

    4c49-bfb2-4d9b7fe2e12d.png)

    G
    发布在 OpenMV Cam

    在判断颜色以后亮红灯

    @kidswong999 # Untitled - By: Administrator - 周三 7月 8 2020

    import sensor, image, time,pyb

    sensor.reset()
    sensor.set_pixformat(sensor.RGB565)
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(time = 2000)

    clock = time.clock()
    while(True):
    clock.tick()
    img = sensor.snapshot()
    print(clock.fps())
    import sensor, image, time

    sensor.reset() # 初始化摄像头
    sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565.
    sensor.set_framesize(sensor.QVGA)
    sensor.skip_frames(10) # 跳过10帧,使新设置生效
    sensor.set_auto_whitebal(False)               # Create a clock object to track the FPS.
    
    ROI=(228,55,15,15)
    
    while(True):
        img = sensor.snapshot()         # Take a picture and return the image.
        statistics=img.get_statistics(roi=ROI)
        color_l=statistics.l_mode()
        color_a=statistics.a_mode()
        color_b=statistics.b_mode()
        print(color_l,color_a,color_b)
        img.draw_rectangle(ROI)
    if color_l>50:
        redled.on()
    else:
        ledled.off()
         灯不会亮,是还要怎么调用吗

    F
    发布在 OpenMV Cam

    在lcd上显示了数据,但由于直接应用的数组 数值略长 如何实现数组分离和得到除法后的结果

    0_16491460113.png

    import sensor, image, time, tf,lcd 
    
    sensor.reset()                         # Reset and initialize the sensor.
    sensor.set_pixformat(sensor.RGB565)    # Set pixel format to RGB565 (or GRAYSCALE)
    sensor.set_framesize(sensor.QVGA)      # Set frame size to QVGA (320x240)
    sensor.set_windowing((240, 240))       # Set 240x240 window.
    sensor.skip_frames(time=2000)   
    lcd.init()       # Let the camera adjust.
    
    
    mobilenet = "openmv_classify.tflite"
    labels = [line.rstrip() for line in open("labels.txt")]
    class_num = len(labels)
    
    clock = time.clock()
    while(True):
        clock.tick()
        img = sensor.snapshot()
        for obj in tf.classify(mobilenet, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
            img.draw_rectangle(obj.rect())
            output = obj.output()
            
            for i in range(class_num):
                print("%s = %f" % (labels[i], output[i]))
        print(clock.fps(), "fps")
    
        img.draw_string(10,110, str(output))              # 文字输入 固定
        img.draw_string(10,100, "no mask            msak")
        
        lcd.display(img)
    

    X
    发布在 OpenMV Cam

    虚拟串口如何得到int型数据?

    想通过虚拟串口接收int数据,但是以下代码却得不到想要的结果。本来应该是发送1,led灯会亮,但是实际上却不行
    0_1669172543696_4f48ba18-0f85-42df-95ae-9c2cda8aa438-image.png
    代码:

    import sensor, image, time, ustruct
    from pyb import USB_VCP,LED
    green_led = LED(2)
    red_led   = LED(1)
    usb = USB_VCP()
    sensor.reset()                      # Reset and initialize the sensor.
    sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
    sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
    sensor.skip_frames(time = 2000)     # Wait for settings take effect.
    
    while(True):
        if USB_VCP.any():
                cmd = usb.readline().decode().strip()
                val = int(cmd)
                if (val == 1):
                    green_led.on()
    

    M
    发布在 OpenMV Cam

    当脱机运行人脸识别代码,LCD屏无任何反应且不能实现识别,重新将摄像头与电脑连接,发现main代码全都乱码。要怎么解决?

    这个是存放在SD卡里的LCD代码

    # LCD显示例程
    #
    # 注意:要运行这个例子,你需要一个用于OpenMV的LCD扩展板。
    #
    # LCD扩展板允许您在运行时查看您的OpenMV Cam的帧缓冲区。
    
    import sensor, image, lcd
    
    sensor.reset() # 初始化sensor
    sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
    #设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种
    
    sensor.set_framesize(sensor.QQVGA2) # 128x160大小的特定液晶屏。
    lcd.init() # 初始化lcd屏幕。
    
    while(True):
        lcd.display(sensor.snapshot()) # 拍照并显示图像。
    
    

    G
    发布在 OpenMV Cam

    为什么 每次录制视频的时间都会少呢?哪位大佬帮忙看看 设置的是录制15个小时 出来每段视频只有20分钟 共30段视频

    你这个rtc我看着不知道什么意思,如果要录制15小时, 可以用millis()判断.

    import sensor, image, time, mjpeg, pyb
    
    RED_LED_PIN = 1
    BLUE_LED_PIN = 3
    
    sensor.reset() # Initialize the camera sensor.
    sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
    sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
    sensor.skip_frames(time = 2000) # Let new settings take affect.
    clock = time.clock() # Tracks FPS.
    
    pyb.LED(RED_LED_PIN).on()
    sensor.skip_frames(time = 2000) # Give the user time to get ready.
    
    pyb.LED(RED_LED_PIN).off()
    pyb.LED(BLUE_LED_PIN).on()
    
    m = mjpeg.Mjpeg("example.mjpeg")
    
    print("You're on camera!")
    start = pyb.millis()
    while (pyb.millis()-start) < 15*60*60*1000:
        clock.tick()
        m.add_frame(sensor.snapshot())
        print(clock.fps())
    
    m.close(clock.fps())
    pyb.LED(BLUE_LED_PIN).off()
    print("Done! Reset the camera to see the saved recording.")
    
    

    发布在 OpenMV Cam
    • 1
    • 2
    • 27
    • 28
    • 29
    • 30
    • 31
    • 49
    • 50
    • 29 / 50