关键点

关键点检测原理

机器视觉里的那些点

他们之间都有哪些关联?

  • 角点 corner
  • 关键点 keypoints
  • 兴趣点 intrest point

角点检测算法 Corner Detection Algorithm

  • Moravec
  • Harris & Stephens
  • SUSAN

Lecture 06:Harris Corner Detector

兴趣点检测算法 interest point detector

  • FAST (可用于实时场景 例如SLAM 机器人)

为什么要进行关键点检测

应用场景

  • 2D tracking
  • 3D tracking
  • SLAM
  • Object Recognition

    关键点检测算法

常见的三种算法。

  • SIFT 对尺度不变的特征变换(SIFT)
  • SURF
  • ORB Oriented FAST and Rotated BRIEF

前两个算法是有专利保护的,用于商业需要收费。 ORB免费,且计算消耗小,所以在OpenMV里关键点检测使用的算法是基于ORB的。

提出ORB算法的论文 ORB: an efficient alternative to SIFT or SURF

FAST

FAST 算法

Bresenham circle 机器学习算法, ID3决策数

优点 非常快速, 高质量的特征检测

缺点 在高水平的噪声下表现不稳定(not robust) 效果依赖与阈值

FAST Algorithm for Corner Detection

Features from Accelerated Segment Test (FAST)

FAST corner detection - Machine learning for high speed corner detection

ORB

  1. FAST keypoint (Corner 角点) detector (不计算偏转)
  2. Harris corner -> TOP N keypoints 获取前N个重要的关键点。
  3. Pyramid金字塔 -> 生成多尺度的特征(multiscale features)
  4. BRIEF descriptor

code


# Object tracking with keypoints example.
# Show the camera an object and then run the script. A set of keypoints will be extracted
# once and then tracked in the following frames. If you want a new set of keypoints re-run
# the script. NOTE: see the docs for arguments to tune find_keypoints and match_keypoints.
import sensor, time, image

# Reset sensor
sensor.reset()

# Sensor settings
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((320, 240))
sensor.set_pixformat(sensor.GRAYSCALE)

sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False, value=100)

def draw_keypoints(img, kpts):
    print(kpts)
    img.draw_keypoints(kpts)
    img = sensor.snapshot()
    time.sleep(1000)

kpts1 = None
# NOTE: uncomment to load a keypoints descriptor from file
#kpts1 = image.load_descriptor("/desc.orb")
#img = sensor.snapshot()
#draw_keypoints(img, kpts1)

clock = time.clock()
while (True):
    clock.tick()
    img = sensor.snapshot()
    if (kpts1 == None):
        # NOTE: By default find_keypoints returns multi-scale keypoints extracted from an image pyramid.
        kpts1 = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2)
        draw_keypoints(img, kpts1)
    else:
        # NOTE: When extracting keypoints to match the first descriptor, we use normalized=True to extract
        # keypoints from the first scale only, which will match one of the scales in the first descriptor.
        kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
        if (kpts2):
            match = image.match_descriptor(kpts1, kpts2, threshold=85)
            if (match.count()>10):
                # If we have at least n "good matches"
                # Draw bounding rectangle and cross.
                img.draw_rectangle(match.rect())
                img.draw_cross(match.cx(), match.cy(), size=10)

            print(kpts2, "matched:%d dt:%d"%(match.count(), match.theta()))
            # NOTE: uncomment if you want to draw the keypoints
            #img.draw_keypoints(kpts2, size=KEYPOINTS_SIZE, matched=True)

    # Draw FPS
    img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
Copyright 杭州云江科技有限公司 2017 all right reserved,powered by Gitbook该文件修订时间: 2018-04-02 09:53:12

results matching ""

    No results matching ""