zoukankan      html  css  js  c++  java
  • Python: scikit-image binary descriptor

    这个用例说明 BRIEF binary description algorithm

    from skimage import data
    from skimage import transform as tf
    from skimage.feature import (match_descriptors, corner_peaks, corner_harris,
                                 plot_matches, BRIEF)
    from skimage.color import rgb2gray
    import matplotlib.pyplot as plt
    
    
    img1 = rgb2gray(data.astronaut())
    tform = tf.AffineTransform(scale=(1.2, 1.2), translation=(0, -100))
    img2 = tf.warp(img1, tform)
    img3 = tf.rotate(img1, 25)
    
    keypoints1 = corner_peaks(corner_harris(img1), min_distance=5)
    keypoints2 = corner_peaks(corner_harris(img2), min_distance=5)
    keypoints3 = corner_peaks(corner_harris(img3), min_distance=5)
    
    extractor = BRIEF()
    
    extractor.extract(img1, keypoints1)
    keypoints1 = keypoints1[extractor.mask]
    descriptors1 = extractor.descriptors
    
    extractor.extract(img2, keypoints2)
    keypoints2 = keypoints2[extractor.mask]
    descriptors2 = extractor.descriptors
    
    extractor.extract(img3, keypoints3)
    keypoints3 = keypoints3[extractor.mask]
    descriptors3 = extractor.descriptors
    
    matches12 = match_descriptors(descriptors1, descriptors2, cross_check=True)
    matches13 = match_descriptors(descriptors1, descriptors3, cross_check=True)
    
    fig, ax = plt.subplots(nrows=2, ncols=1)
    
    plt.gray()
    
    plot_matches(ax[0], img1, img2, keypoints1, keypoints2, matches12)
    ax[0].axis('off')
    
    plot_matches(ax[1], img1, img3, keypoints1, keypoints3, matches13)
    ax[1].axis('off')
    
    plt.show()

    这里写图片描写叙述

  • 相关阅读:
    java设计模式简介
    java设计模式--单例模式
    判断整形回文数
    常用正则表达式 捕获组(分组)
    [转]十分钟搞定Vue搭建
    ActiveX界面已显示,调用方法报undefined的处理办法
    [转]纯js导出json到excel(支持chrome)
    webapi 开启gzip压缩
    webapi下载文件
    iis添加共享目录为虚拟目录
  • 原文地址:https://www.cnblogs.com/gavanwanggw/p/6999511.html
Copyright © 2011-2022 走看看