Consider this binary image:
0 1 0 0 0
0 1 0 0 0
0 1 1 0 0
0 0 0 0 0
0 0 0 1 0
I am looking for a function with two coordinates as parameters, and a boolean return value, which states, if the two pixels are connected (by 4- or 8-connectivity), like this:
f([1,2],[3,3]) -> true;
f([1,2],[5,4]) -> false;
I know, that there must be an easy algorithm, and there are some functions in Matlab, which do much more (bwdist, bwconncomp), but I'm looking for a simpler way.
Thanks for the help!