# How to find the nearnest object to a clicked point in a binary image?

3 Ansichten (letzte 30 Tage)
Meshooo am 10 Feb. 2015
Beantwortet: Image Analyst am 10 Feb. 2015
Dear all,
I have a binary image that has two sperated white pixel A and B = 1 and far from each other.
If I use [x_cordinate, y_cordinate] = ginput(1) and clicked somewhere in the image, then is there some way to know which of the points A or B is the closest to the clicked pixel?
Any help will be appreciated.
Meshoo
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Image Analyst am 10 Feb. 2015
If they're just a single pixel, and you know their coordinates, just use the Pythagorean theorem. You can use sqrt() or hypot() - your choice.
If they not just a single pixel, but an extended blob, then first read this and then let me know.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Image Arithmetic finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by