• 图像识别之特征点检测


    '''
        特征点检测:
            常用特征点检测有:STAR特征点检测 / SIFT特征点检测
            特征点检测结合了边缘检测与角点检测从而识别出图形的特征点。
            STAR特征点检测相关API如下:
                import cv2 as cv
                # 创建STAR特征点检测器
                star = cv.xfeatures2d.StarDetector_create()
                # 检测出gray图像所有的特征点
                keypoints = star.detect(gray)
                # drawKeypoints方法可以把所有的特征点绘制在mixture图像中
                cv.drawKeypoints(original, keypoints, mixture,
                                 flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
                cv.imshow('Mixture', mixture)
    '''
    import cv2 as cv
    
    original = cv.imread('./ml_data/table.jpg')
    cv.imshow('Original', original)
    gray = cv.cvtColor(original, cv.COLOR_BGR2GRAY)
    cv.imshow('Gray', gray)
    # 创建特征点检测器
    star = cv.xfeatures2d.StarDetector_create()
    keypoints = star.detect(gray)
    mixture = original.copy()
    cv.drawKeypoints(original, keypoints, mixture, flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
    cv.imshow('Mixture', mixture)
    
    cv.waitKey()

    '''
        特征点检测:
            常用特征点检测有:STAR特征点检测 / SIFT特征点检测
            特征点检测结合了边缘检测与角点检测从而识别出图形的特征点。
            STAR特征点检测相关API如下:
                import cv2 as cv
                # 创建STAR特征点检测器
                star = cv.xfeatures2d.StarDetector_create()
                # 检测出gray图像所有的特征点
                keypoints = star.detect(gray)
                # drawKeypoints方法可以把所有的特征点绘制在mixture图像中
                cv.drawKeypoints(original, keypoints, mixture,
                                 flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
                cv.imshow('Mixture', mixture)
    '''
    import cv2 as cv
    
    original = cv.imread('./ml_data/table.jpg')
    cv.imshow('Original', original)
    gray = cv.cvtColor(original, cv.COLOR_BGR2GRAY)
    cv.imshow('Gray', gray)
    # 创建特征点检测器
    sift = cv.xfeatures2d.SIFT_create()
    keypoints = sift.detect(gray)
    mixture = original.copy()
    cv.drawKeypoints(original, keypoints, mixture, flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
    cv.imshow('Mixture', mixture)
    
    cv.waitKey()
  • 相关阅读:
    anaconda3 notebook for python数据分析-环境搭建
    MySQL之day4
    MySQL之day3
    MySQL之day2
    综合大实验(按需求完成)
    策略路由实验ACL配置
    双点双向重分布实验
    OSPF实验isis协议的设置命令
    OSPFS实验流量优化
    OSPF实验大串连
  • 原文地址:https://www.cnblogs.com/yuxiangyang/p/11257968.html
Copyright © 2020-2023  润新知