Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

epipolarLine

ステレオ イメージのエピポーラ線を計算

説明

lines = epipolarLine(F,points) は、M 行 3 列の行列、lines を返します。この行列は、イメージ I1 内の points に対応する、イメージ I2 内の計算されたエピポーラ線を表します。入力 F は、I1 内の点をイメージ I2 内のエピポーラ線にマッピングする基礎行列を表します。

lines = epipolarLine(F',points) この行列は、イメージ I2 内の points に対応する、イメージ I1 内の計算されたエピポーラ線を表します。

すべて折りたたむ

この例では、基礎行列を計算する方法を示します。最小二乗中央値法を使用して、インライアを検出します。

matched_points1 と matched_points2 は、推定的にマッチされた点です。

load stereoPointPairs
[fLMedS,inliers] = estimateFundamentalMatrix(matchedPoints1,...
    matchedPoints2,'NumTrials',4000);

1 番目のイメージのインライアを表示します。

I1 = imread('viprectification_deskLeft.png');
figure; 
subplot(121);
imshow(I1); 
title('Inliers and Epipolar Lines in First Image'); hold on;
plot(matchedPoints1(inliers,1),matchedPoints1(inliers,2),'go')

Figure contains an axes object. The axes object with title Inliers and Epipolar Lines in First Image contains 2 objects of type image, line. One or more of the lines displays its values using only markers

1 番目のイメージのエピポーラ線を計算します。

epiLines = epipolarLine(fLMedS',matchedPoints2(inliers,:));

ラインとイメージ境界の交点を計算します。

points = lineToBorderPoints(epiLines,size(I1));

1 番目のイメージのエピポーラ線を表示します。

line(points(:,[1,3])',points(:,[2,4])');

Figure contains an axes object. The axes object with title Inliers and Epipolar Lines in First Image contains 11 objects of type image, line. One or more of the lines displays its values using only markers

2 番目のイメージのインライアを表示します。

I2 = imread('viprectification_deskRight.png');
subplot(122); 
imshow(I2);
title('Inliers and Epipolar Lines in Second Image'); hold on;
plot(matchedPoints2(inliers,1),matchedPoints2(inliers,2),'go')

Figure contains 2 axes objects. Axes object 1 with title Inliers and Epipolar Lines in First Image contains 11 objects of type image, line. One or more of the lines displays its values using only markers Axes object 2 with title Inliers and Epipolar Lines in Second Image contains 2 objects of type image, line. One or more of the lines displays its values using only markers

2 番目のイメージのエピポーラ線を計算して表示します。

epiLines = epipolarLine(fLMedS,matchedPoints1(inliers,:));
points = lineToBorderPoints(epiLines,size(I2));
line(points(:,[1,3])',points(:,[2,4])');
truesize;

Figure contains 2 axes objects. Axes object 1 with title Inliers and Epipolar Lines in First Image contains 11 objects of type image, line. One or more of the lines displays its values using only markers Axes object 2 with title Inliers and Epipolar Lines in Second Image contains 11 objects of type image, line. One or more of the lines displays its values using only markers

入力引数

すべて折りたたむ

基礎行列。3 行 3 列の行列として指定します。F は、double または single でなければなりません。P1 が 2 番目のイメージ I2 内の点 P2 に対応する 1 番目のイメージ I1 内の点を表すとすると、以下が成り立ちます。

[P2,1] * F * [P1,1]' = 0

コンピューター ビジョンでは、基礎行列は、ステレオ イメージ内の対応する点を関連付ける 3 行 3 列の行列になります。2 台のカメラで 2 つの異なる位置から 3 次元シーンを見る場合、3 次元の点とその 2 次元イメージへの投影との間にはいくつかの幾何学的関係があり、イメージ ポイント間の制約となります。同じシーンの 2 つのイメージは、エピポーラ幾何によって関連付けられます。

データ型: single | double

基礎行列。3 行 3 列の行列として指定します。基礎行列 F' は、イメージ I2 内の点をイメージ I1 内のエピポーラ線にマッピングします。

データ型: single | double

点の座標。M 行 2 列の行列 (M は点の数)、または特徴点オブジェクトとして指定します。行列には、各点の (x,y) 座標が含まれます。サポートされている特徴点オブジェクトの詳細については、特徴点のタイプを参照してください。

データ型: single | double

出力引数

すべて折りたたむ

M 行 3 列の行列。M はラインの数を表します。行列の各行は [A,B,C] の形式でなければなりません。これらの値は、次のラインの定義に対応しています。

A * x + B * y + C = 0.

拡張機能

C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。

バージョン履歴

R2011a で導入

すべて展開する