串口发送指令给OpenMV截图 搜集测试数据

Wire Connection

snapshot_with_ide_wire_connnect

snapshot_with_ide_framework

Source Code

# Snapshot Example
#
# Note: You will need an SD card to run this example.
#
# You can use your OpenMV Cam to save image files.

import sensor
import image
import pyb
import time
from pyb import UART

RED_LED_PIN = 1
BLUE_LED_PIN = 3

uart = UART(3, 115200)


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.

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).off()

# print("You're on camera!")

count = 0


while True:

    if (uart.any()):
        data = uart.readall()

        sensor.snapshot().save("%d.jpg"%(count)) # or "example.bmp" (or others)
        print("Take Photo %d"%(count))
        pyb.LED(BLUE_LED_PIN).on()
        time.sleep(100)
        pyb.LED(BLUE_LED_PIN).off()

        count = count + 1
    else:
        # 啥事儿不干
        sensor.snapshot()
        time.sleep(100)

IDE

snapshot_with_uart_ide

Samples

Positive Sample

uart_snapshot_02

Negative Sample

uart_snapshot_01

Copyright 杭州云江科技有限公司 2017 all right reserved,powered by Gitbook该文件修订时间: 2019-04-06 01:22:36

results matching ""

    No results matching ""