How do I measure distance between all pixels in a letter?

조회 수: 2 (최근 30일)
mr
mr 2021년 12월 5일
댓글: Matt J 2021년 12월 6일
I have an image like this:
and would need to measure the distance of all black pixels (which make up the letter T) from each other.
Can anyone recommend the best way?
I am particularly interested in the distance between pixels that make up the 'border' of the T, essentially this:
would you advise that I first turn the T into its own perimeter only (as in the second figure) and then map? Or is there a clever way to say "just map distances between pixels at the edge)?
many thanks
  댓글 수: 1
Voss
Voss 2021년 12월 5일
Say the border of the T contains 1000 pixels. Then the distance of all pixels from each other is a set of 1000*999 = 999000 distances (or 1000*1000 = 1000000 distances if we include the zero distances that each pixel is away from itself). Is that what you want to do?

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

답변 (1개)

Matt J
Matt J 2021년 12월 5일
load image
[i,j]=find(bwperim(A))
distances=pdist2([i,j], [i,j]);
  댓글 수: 2
mr
mr 2021년 12월 6일
sorry, basic question, how did you save my image as logical structure?
Matt J
Matt J 2021년 12월 6일
I used imbinarize().

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by