Figureに出力さ​れた全ての黄色の線の​長さの平均を三平方の​定理を用いて出すコー​ドを教えてください。

4 vues (au cours des 30 derniers jours)
玲央 宝泉
玲央 宝泉 le 13 Nov 2022
Modifié(e) : Atsushi Ueno le 13 Nov 2022
clear all
% MATLAB で用意されている画像の読み込み
I1 = rgb2gray(imread('viprectification_deskLeft.png'));
I2 = rgb2gray(imread('viprectification_deskRight.png'));
% 特徴の検出
points1 = detectHarrisFeatures(I1);
points2 = detectHarrisFeatures(I2);
% 特徴の記述
[features1,valid_points1] = extractFeatures(I1,points1);
[features2,valid_points2] = extractFeatures(I2,points2);
% 特徴をマッチング
indexPairs = matchFeatures(features1,features2);
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
% マッチングの表示
figure;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2);
% 以下に、Figureに出力された全ての黄色の線の平均を三平方の定理を用いて出すコード

Réponse acceptée

Atsushi Ueno
Atsushi Ueno le 13 Nov 2022
Modifié(e) : Atsushi Ueno le 13 Nov 2022
長さの平均にmean関数を、三平方の定理に hypot 関数を使いました。
% 以下に、Figureに出力された全ての黄色の線の平均を三平方の定理を用いて出すコード
df = matchedPoints1.Location - matchedPoints2.Location;
AveLen = mean(hypot(df(:,1),df(:,2)))

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision Toolbox dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!