MATLAB Answers

How to get the distance from an image ?

1 view (last 30 days)
Chuanjung Lin
Chuanjung Lin on 9 Sep 2020
Hi all, I have a question about the distance acquire from a image, and the image as folloing:
in the fiste step, I'll conver the image to grey and extrcat its edge.
The question is :
  1. How to get the center point (w)?
  2. How to get the distacne from W to other point ?

  3 Comments

KSSV
KSSV on 9 Sep 2020
You can obtain them by gui using getpts/ ginpiut and imdistance.
Chuanjung Lin
Chuanjung Lin on 9 Sep 2020
Actually, I'v many images, so, I would like to use code to automatic run it. Thank you.
Rik
Rik on 9 Sep 2020
Then you will have to write code to determine the coordinates.

Sign in to comment.

Answers (1)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi on 15 Sep 2020
Hi Lin,
"How to get the center point?"
  • From the question, it isn't very clear how you define the the image. Have a look at the regionprops function to get the centroid of the image. You could otherwise also simply calculate from the average of the extremeties of the image coordinates.
"How to get the distance from W to other point?"
As previously mentioned on the thread, you may have to programmatically call all these functions on your image set iteratively.
Hope this helps!

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!