导航

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

    高级搜索

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

    LCD显示和光源扩展板冲突吗??

    # Untitled - By: Administrator - Fri Apr 12 2024
    
    import sensor, image, time
    import display
    from pyb import UART, Pin,Timer
    sensor.reset()
    sensor.set_pixformat(sensor.RGB565)
    sensor.set_framesize(sensor.QQVGA)
    sensor.skip_frames(time = 2000)
    lcd = display.SPIDisplay()
    light = Timer(4, freq=50000).channel(1, Timer.PWM, pin=Pin("P7"))
    light.pulse_width_percent(10) # 控制亮度 0~100
    clock = time.clock()
    while(True):
        clock.tick()
        lcd.write(sensor.snapshot())
        print(clock.fps())
    
    

    发布在 OpenMV Cam

    openmv4h plus mt9v034相机,报RuntimeError:Sensor control failed.

    openmv4h plus mt9v034相机,上电启动有时候会报RuntimeError:Sensor control failed.
    sensor.reset() # Reset and initialize the sensor.
    sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE),BAYER
    sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240),QQVGA2 (128160),QQVGA(160120)
    sensor.set_vflip(True)
    sensor.set_hmirror(False)
    sensor.set_transpose(True)
    sensor.set_auto_exposure(False,exposure_us=EXPS)
    ‘’‘

    ’‘’

    M
    发布在 OpenMV Cam

    pycharm可以调用openmv的摄像头吗

    import sensor, time, pyb, ubinascii

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

    while True:
    img = sensor.snapshot().compress(quality=70) # 压缩质量为70%
    hex_data = ubinascii.hexlify(img).decode() # 转为十六进制字符串
    print(hex_data) # 发送数据
    pyb.delay(1000)
    此代码放在openmv ide烧录

    I
    发布在 OpenMV Cam

    find_numbers历程进行数字识别,2s后显示没有找到相关属性?

    LetNet Example

    import sensor, image, time

    sensor.reset() # Reset and initialize the sensor.
    sensor.set_contrast(3)
    sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
    sensor.set_framesize(sensor.VGA) # Set frame size to QVGA (320x240)
    sensor.set_windowing((128, 128)) # Set 128x128 window.
    sensor.skip_frames(time = 2000) # Wait for settings take effect.
    sensor.set_auto_gain(False)
    sensor.set_auto_exposure(False)

    while(True):
    img = sensor.snapshot()
    # NOTE: Uncomment to detect dark numbers on white background
    # img.invert()
    out = img.find_number(roi=(img.width()//2-14, img.height()//2-14, 28, 28))
    img.draw_rectangle((img.width()//2-15, img.height()//2-15, 30, 30))
    if out[1] > 5: # Confidence level
    print("Number: %d Confidence: %0.2f" %(out[0], out[1]))

    报错提示
    Traceback (most recent call last):
    File "", line 17, in
    AttributeError: 'Image' object has no attribute 'find_number'
    MicroPython v1.9.4-4510-g23e8457de on 2018-06-29; OPENMV3 with STM32F765
    Type "help()" for more information.

    缘
    发布在 OpenMV Cam

    用保存视频的例程,在sd卡里的视频怎么是0字节大小?

    @kidswong999 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(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("test1.mjpeg")

    #mjpeg.Mjpeg(filename, width=Auto, height=Auto)创建一个mjpeg对象,

    #filename为保存mjpeg动图的文件路径

    print("You're on camera!")

    for i in range(200):

    clock.tick()
    
    m.add_frame(sensor.snapshot())
    
    #mjpeg.add_frame(image, quality=50)
    
    #quality为视频压缩质量。
    
    print(clock.fps())
    

    m.close(clock.fps())

    pyb.LED(BLUE_LED_PIN).off()

    print("Done! Reset the camera to see the saved recording.")
    测试的例程,重新上电还是一样0字节

    U
    发布在 OpenMV Cam

    运行测试的例程,openmv重新上电后,sd卡里的视频0字节大小,打不开?

    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(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("test1.mjpeg")
    #mjpeg.Mjpeg(filename, width=Auto, height=Auto)创建一个mjpeg对象,
    #filename为保存mjpeg动图的文件路径
    print("You're on camera!")
    for i in range(200):
    clock.tick()

    m.add_frame(sensor.snapshot())

    #mjpeg.add_frame(image, quality=50)

    #quality为视频压缩质量。

    print(clock.fps())
    m.close(clock.fps())
    pyb.LED(BLUE_LED_PIN).off()
    print("Done! Reset the camera to see the saved recording.")
    测试的例程,重新上电还是一样0字节

    U
    发布在 OpenMV Cam

    串口接收数据,程序只执行一下子,openmv直接卡死,报错

    
    import sensor, image, time
    from pyb import UART
    
    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.
    clock = time.clock()                # Create a clock object to track the FPS.
    
    uart = UART(3, 115200)
    a=0
    
    while(True):
        clock.tick()                    # Update the FPS clock.
        img = sensor.snapshot()         # Take a picture and return the image.
        print(clock.fps())              # Note: OpenMV Cam runs about half as fast when connected
                                        # to the IDE. The FPS should increase once disconnected.
        #code = 'A'
        #print(code)
        #uart.write(code)    
        if uart.any():
            recieve = uart.readline().decode().strip()
            print(recieve)
    
    
        if recieve == 'L':
            print("We win.")
            a=a+1
            print(a)
            print("\n")
        
        else:
            print("No FOUND")
            
    
    

    0_1556526948034_fd6df678-69d5-4353-9c99-885090de2e0a-image.png

    I
    发布在 OpenMV Cam

    串口接收数据,程序只执行一下子,openmv直接卡死,报错

    你的代码不对,if recieve == 'L':应该在if uart.any():里面。

    import sensor, image, time
    from pyb import UART
    
    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.
    clock = time.clock()                # Create a clock object to track the FPS.
    
    uart = UART(3, 115200)
    a=0
    
    while(True):
        clock.tick()                    # Update the FPS clock.
        img = sensor.snapshot()         # Take a picture and return the image.
        print(clock.fps())              # Note: OpenMV Cam runs about half as fast when connected
                                        # to the IDE. The FPS should increase once disconnected.
        #code = 'A'
        #print(code)
        #uart.write(code)    
        if uart.any():
            recieve = uart.readline().decode().strip()
            print(recieve)
            if recieve == 'L':
                print("We win.")
                a=a+1
                print(a)
                print("\n")
        
        else:
            print("No FOUND")
    

    发布在 OpenMV Cam

    图像处理函数问题求解?

    我使用如下函数,为什么得到的结果是这样的啊
    0_1562508688278_91369e66-754a-42ec-8ea7-0a25d1624219-image.png
    使用前:
    0_1562508729218_4d328671-4df6-4385-a2e5-7d23292a7d66-image.png
    使用后:
    0_1562508758278_0fb10c6f-42e9-4221-a460-cd9686d8b7bc-image.png

    代码如下:

    import sensor, image, time
    
    sensor.reset()                      # Reset and initialize the sensor.
    sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
    sensor.set_framesize(sensor.QQVGA)   # Set frame size to QQVGA (160x120)
    sensor.skip_frames(time = 2000)     # Wait for settings take effect.
    clock = time.clock()                # Create a clock object to track the FPS.
    
    while(True):
        clock.tick()                    # Update the FPS clock.
        img = sensor.snapshot()
        # img这里是彩色
        img = img.to_grayscale()
        # img这里是灰色
        print(clock.fps())
    

    B
    发布在 OpenMV Cam

    请问编译的时候为什么会出现'blob' object has no attribute 'pixel'?

    import sensor, image, time
    import car
    from pyb import LED
    from pyb import Pin
    
    sensor.reset() # Initialize the camera sensor.
    sensor.set_pixformat(sensor.RGB565) # use RGB565.
    sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
    sensor.skip_frames(10) # Let new settings take affect.
    sensor.set_auto_whitebal(False) # turn this off.
    clock = time.clock() # Tracks FPS.
    
    green_threshold   = (31, 66, -34, -9, -2, 18)
    
    def find_max(blobs):    #寻找最大面积的球
        max_size=0
        for blob in blobs:
            if blob[2]*blob[3] > max_size:
                max_blob=blob
                max_size = blob[2]*blob[3]
        return max_blob
    
    while(True):
    
        clock.tick() # Track elapsed milliseconds between snapshots().
        img = sensor.snapshot() # Take a picture and return the image.
        
        blobs = img.find_blobs([green_threshold])
        if blobs:
            max_blob = find_max(blobs)
            x_error = max_blob[5]-img.width()/2        
            for greenblord_threshold in  blobs:
                if greenblord_threshold.pixel() > 2000:
                    car.run(30-0.5*green_x_error,30+0.5*green_x_error)
    	
                elif greenblord_threshold.pixel() < 10000:
                    car.run(0,0)
        else:
            car.run(20,-20)
    
    
    

    Z
    发布在 OpenMV Cam
    • 1
    • 2
    • 33
    • 34
    • 35
    • 36
    • 37
    • 49
    • 50
    • 35 / 50