www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I2_05_2_regist_cpselect.m

    %% 2偮偺夋憸偺埵抲崌偣(儗僕僗僩儗乕僔儑儞)
clear;clc;close all;imtool close all

%% 夋憸撉傒崬傒
aerial = imread('westconcordaerial.png');
figure, imshow(aerial)
ortho = imread('westconcordorthophoto.png');
figure, imshow(ortho)

%% 帠慜偵慖戰偟偨暋悢偺揰傪撉傒崬傒
load westconcordpoints

%% 僐儞僩儘乕儖 億僀儞僩慖戰僣乕儖傪奐偒傑偡丅
% 捛壛偺揰傪慖戰偡傞偨傔丄'Wait' 僷儔儊乕僞乕傪巊梡偟偰丄cpselect 傪懸婡忬懺偵偟傑偡丅
[aerial_points,ortho_points] = ...
       cpselect(aerial,'westconcordorthophoto.png',...
                movingPoints,fixedPoints,...
                'Wait',true);
%% 儗僕僗僩儗乕僔儑儞傪幚峴
% fitgeotrans 傪巊梡偟偰丄堏摦僀儊乕僕傪屌掕僀儊乕僕偵埵抲崌傢偣偡傞婔壗妛揑曄姺傪悇掕偟傑偡丅
% 慖戰偟偨僐儞僩儘乕儖 億僀儞僩偲昁梫側曄姺僞僀僾傪巜掕偟傑偡丅
t_concord = fitgeotrans(aerial_points,ortho_points,'projective');

%% imwarp 傪巊梡偟偰曄姺傪幚峴
ortho_ref = imref2d(size(ortho)); %relate intrinsic and world coordinates
aerial_registered = imwarp(aerial,t_concord,'OutputView',ortho_ref);
figure, imshowpair(aerial_registered,ortho,'blend')

%%  尦偺惓幩幨恀忋偵曄姺屻偺僀儊乕僕傪昞帵
% 儗僕僗僩儗乕僔儑儞偺岠壥傪妋擣
figure, imshowpair(aerial_registered,ortho,'blend')

%% 廔椆

% Copyright 2014 The MathWorks, Inc.