how to calculate the distance between two pixels?

 채택된 답변

vaishali
vaishali 2013년 9월 21일

1 개 추천

dist=sqrt((y2-y1)^2+(x2-x1)^2);%%%% Where (x1,y1) and (x2,y2) are coordinates of two pixels

추가 답변 (1개)

tami
tami 2014년 6월 9일

0 개 추천

hello, i actually have a followup question, I am trying to find a way to calculate the distance between edges of an image created by edge detection toolbox. The edges are painted white on the image, and i need to somehow calculate the distance automatically between the longest distance of each edge. For example if the edge is a square - i would like to calculate the width and length of it.
Thank you Tamir

댓글 수: 4

tami
tami 2014년 6월 9일
What you are asking for can be done all though it does require advanced programming capabilities, first you must write a function that detects all the pixels that have been changed due to the edge detection function and use a Gaussian algorithem to calculate each pixels distance from all the other pixels.
dist=sqrt((y2-y1)^2+(x2-x1)^2);%%%% Where (x1,y1) and (x2,y2) are coordinates of two pixels
This is not recommended for beginners using MATLAB. Good luck
Sayfeddine Veerbeek.
tami
tami 2014년 6월 9일
Thank you for the quick reply.
How many hours would it take to write that code? Tamir.
tami
tami 2014년 6월 9일
About 20-30 hrs. for a seasoned programmer.
Sayfeddine Veerbeek.
if you use images in the form of matrices and command like d(i,j)=sqrt((y2(i,j)-y1(i,j))^2+(x2(i,j)-x1(i,j)^2) then it becomes easier.i am not sure but try this one.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2013년 9월 21일

댓글:

2016년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by