1.Apriltag識別
Apriltag是openmv標准鏡頭中識別准確率和速度最快的一個,apriltag中一類識別輸出為0-10.
2.下載apriltag標簽圖片:
3. 復制openmv apriltag源碼到openmv ide中(ide下載安裝鏈接:https://book.openmv.cc/quick-starter.html)
# AprilTags Example # # This example shows the power of the OpenMV Cam to detect April Tags # on the OpenMV Cam M7. The M4 versions cannot detect April Tags. import sensor, image, time, math from pyb import LED sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger... sensor.skip_frames(30) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() led=LED(1) led.toggle() a=0 while(True): clock.tick() img = sensor.snapshot() for tag in img.find_apriltags(): # defaults to TAG36H11 without "families". img.draw_rectangle(tag.rect(), color = (255, 0, 0)) img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0)) degress = 180 * tag.rotation() / math.pi print(tag.id(),degress) if a%2 ==0: led.on() else: led.off() a=a+1
4.在openmv ide中,連接openmv(通電之后點擊左下角灰色的那個按鍵),然后點擊工具-將打開的腳本保存到Openmv Cam中,實現程序脫機運行。也可以點擊左下角的綠色三角實現程序直接運行。
5.將openmv與電腦斷開,給openmv通上電,識別Apriltag碼可輸出對應的數字,同時看到openmv上的紅色led燈閃爍。