Computing Euclidean distance between two white pixels

20 views
Skip to first unread message

mathie...@gmail.com

unread,
May 7, 2015, 4:43:52 PM5/7/15
to mamba...@googlegroups.com
Hello,

Based on example M7, I have computed geodesic diameters of fish school images.
I'm now trying to compute geodesic tortuosity indices as well (cf. Geodesic attributes thinnings and thickenings, Morard et al.).
For that purpose, I need to compute the Euclidean distance between the extremities of the geodesic diameter (i.e. 2 white pixels). Is there a way to do it with Mamba?

Thanks in advance,

Mathieu

Serge Beucher

unread,
May 15, 2015, 2:14:27 PM5/15/15
to mamba...@googlegroups.com
Hi,

Sorry for the long delay (travelling...).

There is a simple way to obtain the coordinates of the first non zero pixel of an image by means of the image "compare" statement. Suppose your image im1 contains a single non zero pixel. Then the foolowing statements provide its coordinates:

imwrk = imageMb(im1)
# defines an empty working image
(x,y) = compare(im1, imwrk, imwrk)
# (x, y) contains the coordinates of the single pixel of im1

If im1 contains more than one pixel, the coordinates of the first non zero pixel in the video scanning order will be returned.


So you can extract each extremity of your set (with a label instruction followed by a threshold for instance) and obtain the euclidean distance thanks to the Pythagore's formula.

Sincerely,

Serge




--
You received this message because you are subscribed to the Google Groups "Mamba Image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mamba-image...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages