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

2 views (last 30 days)
玲央 宝泉
玲央 宝泉 on 13 Nov 2022
Edited: Atsushi Ueno on 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に出力された全ての黄色の線の平均を三平方の定理を用いて出すコード

Accepted Answer

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

More Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!