資源簡介
根據源碼改的openmv識別特定顏色跟蹤并標記,顏色閾值可自行設置,默認打印識別到物體的中心點,可通過串口傳輸到單片機或其他設備
代碼片段和文件信息
#@Luan/2019/7
#改編跟蹤識別且發送
#?Pin?P4?to?the?serial?input?of?a?serial?LCD?screen?to?see?data?printed
#?on?the?serial?LCD?display.
import?sensor?image?time?math
from?pyb?import?UART
#?Always?pass?UART?3?for?the?UART?number?for?your?OpenMV?Cam.
#?The?second?argument?is?the?UART?baud?rate.?For?a?more?advanced?UART?control
#?example?see?the?BLE-Shield?driver.
uart?=?UART(3?19200?timeout_char=1000)????#串口3?波特率19200?超時時間1s
threshold_index?=?0?#?0?for?red?1?for?green?2?for?blue
#?Color?Tracking?Thresholds?(L?Min?L?Max?A?Min?A?Max?B?Min?B?Max)
#?The?below?thresholds?track?in?general?red/green/blue?things.?You?may?wish?to?tune?them...
thresholds?=?[(30?100?15?127?15?127)?#?generic_red_thresholds
??????????????(30?100?-64?-8?-32?32)?#?generic_green_thresholds
?
評論
共有 條評論