Issue in finding euclidean distance between 2 images

1 回表示 (過去 30 日間)
Chathu
Chathu 2015 年 2 月 17 日
編集済み: Chathu 2015 年 2 月 25 日
What is the best way to find the Euclidean distance in two images?
I have 2 images in 1,2,1 and 1,2,2 positions in fig format(pls note that these images are 16.3MB in size). My expectation is to select similar features in 2 images and calculate the euclidean distance, afterwards. But when i use below code i cannot smoothly select points. Can someone help me to solve this issue?
clc
clear all
openfig('1 Ref n Mov.fig')
[x,y]=ginput(2)
line([x(1), x(end)], [y(1), y(end)]);
dist = sqrt((x(end)-x(1))^2 + (y(end)-y(1))^2)

回答 (1 件)

Image Analyst
Image Analyst 2015 年 2 月 17 日
Try cpselect() in the Image Processing Toolbox.
  3 件のコメント
Image Analyst
Image Analyst 2015 年 2 月 21 日
So just use the standard demo image like cameraman. You don't have to attach it because I have it, but you do have to attach your code for cpselect because I don't know what you did.
Or why can't you just use ginput(1) twice, once on each image. I don't understand why it's so hard to just indicate two locations on two images and use sqrt((x2-x1)^2+(y2-y1)^2).
Chathu
Chathu 2015 年 2 月 23 日
編集済み: Chathu 2015 年 2 月 25 日
Image Analyst- thank you v much for your response. By using the above code i was able to get two values but my doubt here when i run the code i can only see a line only on one image. BUT my expectation is to draw a line from 1st subplot to the 2nd subplot and then find the euclidean distance.How can i do that?
For cpselect:, i used,
fixed = imread('1-fixed.jpg');
moving = imread('1-register.jpg');
cpselect(moving,fixed)
But how to find the euclidean distance here? Same equation doesn't work? Can you pls be kind enough to give me a solution.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by