Matlab and Mex code for computing Absolute and Relative Fuzzy Connectedness as well as Image Foresting Transform in 2D images.
Code I wrote when designing a lab assignment when teaching the Computer Assisted Image Analysis II Course at the Centre for Image Analysis, Uppsala University back in Fall 2008. The same code was actually later used for bone segmentation in . In case you find this code useful and wish to give credit to it, then please cite .
The file afc.m provides an implementation of Absolute Fuzzy Connectedness according to kFOEMS in .
The files adjacency.m and affinity.m computes adjacency and affinity according to .
The file fctest.m gives an example of how to use the provided functions and to compute a Fuzzy Connected Component.
The file irfc.m provides an implementation of Iterated Relative Fuzzy Connectedness according to kIR- MOFS in . That function calls afc.m a number of times to partition an image into components defined by multiple seeds from at least two classes. Classes are given by seed numbers starting from 1.
The file ift.m provides an implementation of the Image Foresting Transform (IFT) according to  but without tie-breaking (just first pick). The IFT provides very similar result as IRFC but without the need for iterations, and is therefore preferable to use.
The file fctest2.m gives an example of how to use the provided functions to perform seeded segmentation using Relative Fuzzy Connectedness.
Files afc.cc and ift.cc provide c++ Mex implementations of the respective m-files. To make everything run a lot faster, execute the following in Matlab:
> mex afc.cc
> mex ift.cc
I have tried my best to stay faithfull to the descriptions in the references below. Do not use on too large image; the code is more aimed at pedagogic use than speed.
 J. Lindblad, N. Sladoje, V. Ćurić, H. Sarve, C.B. Johansson, and G. Borgefors. Improved quantification of bone remodelling by utilizing fuzzy based segmentation. In Proceedings of the 16th Scandinavian Conference on Image Analysis (SCIA), LNCS-5575, pp. 750-759, Oslo, Norway, June 2009. doi:10.1007/978-3-642-02230-2_77
 J.K. Udupa and S. Samarasekera. Fuzzy connectedness and object definition: theory, algorithms, and application in image segmentation. Graphical Models and Image Processing, 58(3):246–261, 1996.
 P.K. Saha and J.K. Udupa. Fuzzy connected object delineation: axiomatic path strength definition and the case of multiple seeds. Computer Vision and Image Understanding, 83:275–295, 2001.
 K.C. Ciesielski, J.K. Udupa, P.K. Saha, and Y. Zhuge. Iterative relative fuzzy connectedness for multiple objects with multiple seeds. Computer Vision and Image Understanding, 107:160–182, 2007.
 F. Malmberg, J. Lindblad, and I. Nyström. Sub-pixel Segmentation with the Image Foresting Transform. In Proceedings of the 13th International Workshop on Combinatorial Image Analysis (IWCIA), LNCS-5852, pp. 201-211, Playa del Carmen, Mexico, Nov. 2009. doi:10.1007/978-3-642-10210-3_16
Joakim Lindblad (2021). Fuzzy Connectedness (https://github.com/joakimlindblad/FuzzConn), GitHub. Retrieved .
Lindblad, Joakim, et al. “Improved Quantification of Bone Remodelling by Utilizing Fuzzy Based Segmentation.” Image Analysis, Springer Berlin Heidelberg, 2009, pp. 750–59, doi:10.1007/978-3-642-02230-2_77.
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!