Version (15.2 KB) by ja
Segment multiple surfaces simultaneously in any number of dimensions
Updated 21 Mar 2018

View License

Uses a min-cost closed set approach to multi-surface segmentation in any number of dimensions. Only one input is required (cost image). If only one input is given, it will assume the surface to be found is orthogonal to the x direction and will return a surface accordingly.
In fact, no inputs are actually required. If no inputs are given, a "test" image is generated for 3-surface segmentation, using a min-cost, max-cost, min-cost search for each layer, respectively. If no inputs are given, the test image is also displayed with the segmentation results.
The second optional input term is the dimension of orthogonality to the surface to be found.
The third optional input term is the smoothness constraints. This determines how far a surface can 'jump' between adjacent pixels. If not given, a value of 1 is assumed.
The fourth optional input is the circularity constraints. This determines if opposite ends of an array are supposed to 'wrap' into each other. Should be an array of size equal to the number of dimensions in the image, with a 1 to correspond to dimensions for which circularity constraints should be enforced. If no input is given, circularity is assumed for all dimensions.
The fifth is the number of surfaces to be found. If not given, 1 surface is assumed.

The sixth option input is the minimum distance between surfaces. This should be an array of size equal to the number of surfaces to be found minus 1. If no input is given a value of 30 is assumed. This can be changed with the DBSS variable at the top of the function.

The seventh is the maximum between-surface distance allowed, and should also be an array of size equal to the number of surfaces minus 1. If no input is given, a value of Infinity is assumed (in some future release I plan to include for the possibility of non-adjacent surface limitations - the coding of it is simple, but the challenge is to figure out how to form the variables in a user-friendly way).

The last input is a mask. The intent of this is to speed up processing time when the general location of a surface is known, for example for downsampled images that are gradually upsampled.

This algorithm was taken almost directly out of the textbook "Image Processing, Analysis, and Machine Vision" (third edition) by Milan Sonka, Vaclav Hlavac, and Roger Boyel, chapter 7.7

Cite As

ja (2024). surfseg(Image,dim,smoothness,circconstraints,nsurf,mindist,maxdist,mask) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

included image