Segmentation_Growin​g(img,sx1,sx2,sy1,s​y2,f)

This function grows from a certain area with a weigthing to the outer boarder of the object
268 Downloads
Aktualisiert 16. Dez 2016

Lizenz anzeigen

This Matlab Function segmentate a object of an image while choosing an area and growing from it with a weighting factor to the boundaries. (see here a description: http://physingo-en.blogspot.de/2016/12/matlab-segmentation-growing.html )
function [region, area, seed, sx1, sx2, sy1, sy2] = Segmentation_Growing(img,sx1,sx2,sy1,sy2,f)
%img is the image which is segmentated
%sx1 and sy1 are the values of the upper left corner and
%sx2 and sy2 are the values of the lower right corner
%f can vary between 1 and 2 and is the weigthing factor
%region is the output of the segmentated region
%if area is in region it's one otherwise it's 0
%seed is the start area
This is a methode of segmentation where a region is defined (seed) . In this seed the standard deviation and the mean is calculated and with a factor f it is weigthed. Pixel which are in the neighborhood of the seed are added to the seed if their value is in the boundary defined by the standard deviation, mean value and weighting factor f. This is done iterative as long as no more pixel is added to the seed. Then the object is segmented.
function [region, area, seed, sx1, sx2, sy1, sy2] = Segmentation_Growing(img,sx1,sx2,sy1,sy2,f):

This function needs an image as an imput. If there is no other input value one can choose with to cursors the starting point sx1, sy1, the left upper corner, and the end point sx2, sy2, the right lower corner. Otherwise one can define the s-value as one wants. If one uses cursors, one can use the second input argument for defining the factor f. This factor describes the weigthing and is in an area bigger equal to 0. This is shown in the following figure below for f=1 (blue), f=1.5 (yellow) and f=2 (green). The red rect shows the chosen seed.
The output of the function is region, which is the segmented object. Area describes the segmented area with value 1 and the rest as 0. Seed logically returns seed, if it is chosen by the cursors.

Zitieren als

Ingo Hermann (2024). Segmentation_Growing(img,sx1,sx2,sy1,sy2,f) (https://www.mathworks.com/matlabcentral/fileexchange/60715-segmentation_growing-img-sx1-sx2-sy1-sy2-f), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2016b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Feature Detection and Extraction finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.32.0.0

Update 1.32: Added a comment

1.31.0.0

Update 1.31: Update description text.

1.3.0.0

Update 1.3: Now one an choose any region with the cursor and the distance output is better scaled.

1.2.0.0

Update 1.2: better definition of area in the code.

1.1.0.0

Update 1.1: It is now possible to segmentate black areas.

1.0.0.0