zoukankan      html  css  js  c++  java
  • 深度学习图像配准 Image Registration: From SIFT to Deep Learning


    What is Image Registration?


     

    Traditional Feature-based Approaches

    Keypoint Detection and Feature Description
    复制代码
    import numpy as np
    import cv2 as cv
    
    img = cv.imread('image.jpg')
    gray= cv.cvtColor(img, cv.COLOR_BGR2GRAY)
    
    akaze = cv.AKAZE_create()
    kp, descriptor = akaze.detectAndCompute(gray, None)
    
    img=cv.drawKeypoints(gray, kp, img)
    cv.imwrite('keypoints.jpg', img)
    复制代码

    For more details on feature detection and description, you can check out this OpenCV tutorial.

    Feature Matching

    复制代码
    import numpy as np
    import cv2 as cv
    import matplotlib.pyplot as plt
    
    img1 = cv.imread('image1.jpg', cv.IMREAD_GRAYSCALE)  # referenceImage
    img2 = cv.imread('image2.jpg', cv.IMREAD_GRAYSCALE)  # sensedImage
    
    # Initiate AKAZE detector
    akaze = cv.AKAZE_create()
    # Find the keypoints and descriptors with SIFT
    kp1, des1 = akaze.detectAndCompute(img1, None)
    kp2, des2 = akaze.detectAndCompute(img2, None)
    
    # BFMatcher with default params
    bf = cv.BFMatcher()
    matches = bf.knnMatch(des1, des2, k=2)
    
    # Apply ratio test
    good_matches = []
    for m,n in matches:
        if m.distance < 0.75*n.distance:
            good_matches.append([m])
            
    # Draw matches
    img3 = cv.drawMatchesKnn(img1,kp1,img2,kp2,good_matches,None,flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
    cv.imwrite('matches.jpg', img3)
    复制代码

    Image Warping

    复制代码
    # Select good matched keypoints
    ref_matched_kpts = np.float32([kp1[m[0].queryIdx].pt for m in good_matches]).reshape(-1,1,2)
    sensed_matched_kpts = np.float32([kp2[m[0].trainIdx].pt for m in good_matches]).reshape(-1,1,2)
    
    # Compute homography
    H, status = cv.findHomography(ref_matched_kpts, sensed_matched_kpts, cv.RANSAC,5.0)
    
    # Warp image
    warped_image = cv.warpPerspective(img1, H, (img1.shape[1]+img2.shape[1], img1.shape[0]))
                
    cv.imwrite('warped.jpg', warped_image)
    复制代码


    Deep Learning Approaches

    Feature Extraction

    Homography Learning

    Their approach introduces two new network structures: a Tensor Direct Linear Transform and a Spatial Transformation Layer. We will not go into the details of these components here, we can simply consider that these are used to obtain a transformed sensed image using the homography parameter outputs of the CNN model, that we then use to compute the photometric loss.

    Other Approaches


     
    _________________________________________________________________________________________________________________________________________________
    每一个不曾起舞的日子,都是对生命的辜负。
    But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
    其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采
  • 相关阅读:
    第七节:扩展组件(lodash/富文本/echart/nprogress) 和 帮助类(日期格式化)
    第六节:基础组件(Cascader/Tab/Steps/Upload/TimeLine/alert) 之 参数/商品/订单
    第九节:Vuex简介、基本使用、核心功能(State、Mutation、Action、Getter) 和 案例实战演练
    第四节:基础组件(Breadcrumb、Card、Input、Dialog、Switch、Select、MessageBox) 之 用户管理
    第三节:基础组件(Container布局、NavMenu导航) 之 系统主页面搭建
    第二节:基础配置(路由、less、静态资源、axios、ESLint)、基础组件(Form、Message) 之登录页面搭建
    第七节:框架全面升级5.x版本及常规组件的升级和集成
    第一节:项目初始化(ElementUI、axios)、Git版本管理、基本环境搭建
    第八节:Vue Cli简介/安装、两种Create项目的方式、相关配置说明
    第三节:ES6模块化历史 及 默认、按需、直接导入导出、Vue单文件
  • 原文地址:https://www.cnblogs.com/leoking01/p/14611959.html
Copyright © 2011-2022 走看看