www.gusucode.com > IPCV_Eval_Kit_R2019a_0ce6858工具箱matlab程序源码 > IPCV_Eval_Kit_R2019a_0ce6858/code/demo_files/I4_09_2_showEpipolarLines.m
clear;clc;close all;imtool close all %% 梊傔媮傔偰偁傞嵍塃偺夋柺忋偺揰傪Load load stereoPointPairs %% 梊傔媮傔偰偁傞嵍塃偺夋柺忋偺揰偐傜丄婎慴峴楍傪悇掕 [fLMedS, inliers] = estimateFundamentalMatrix(matchedPoints1,matchedPoints2,'NumTrials',4000); %% 嵍偺夋憸忋偵丄inlier 偺揰傪昞帵 I1 = imread('viprectification_deskLeft.png'); figure; subplot(1,2,1); imshow(I1); title('Inliers and Epipolar Lines in First Image'); hold on; plot(matchedPoints1(inliers,1), matchedPoints1(inliers,2), 'go') %% Show the inliers in the second image. I2 = imread('viprectification_deskRight.png'); subplot(122); imshow(I2); title('Inliers and Epipole Lines in Second Image'); hold on; plot(matchedPoints2(inliers,1), matchedPoints2(inliers,2), 'go') %% 塃懁偺儅僢僠揰偵懳偡傞丄嵍夋柺忋偺僄僺億乕儔慄 epiLines = epipolarLine(fLMedS', matchedPoints2(inliers, :)); %% Compute the intersection points of the lines and the image border. pts = lineToBorderPoints(epiLines, size(I1)); %% Show the epipolar lines in the first image line(pts(:, [1,3])', pts(:, [2,4])'); %% Compute and show the epipolar lines in the second image. epiLines = epipolarLine(fLMedS, matchedPoints1(inliers, :)); pts = lineToBorderPoints(epiLines, size(I2)); line(pts(:, [1,3])', pts(:, [2,4])'); truesize; %% % Copyright 2014 The MathWorks, Inc.