You are here : matlabImage Processingimsegfmm

imsegfmm() - Image Processing

```BW = imsegfmm(W,mask,thresh) returns
a segmented image BW, which is computed using
the Fast Marching Method. The array W specifies
weights for each pixel. mask is a logical array
that specifies seed locations. thresh is a non-negative
scalar in the range [0 1] which specifies the level
at which imsegfmm thresholds the output of the
Fast Marching Method to obtain the output binary image BW.BW = imsegfmm(W,C,R,thresh) returns
a segmented image, with seed locations specified by the vectors C and R,
which contain column and row indices. C and R must
contain values which are valid pixel indices in W.[BW,D] =
imsegfmm(___) returns the normalized geodesic
distance map D computed using the Fast Marching
Method. BW is a thresholded version of D,
where all the pixels that have normalized geodesic distance values
less than thresh are considered foreground pixels
and set to true. D can be
thresholded at different levels to obtain different segmentation results.```

Syntax

```BW = imsegfmm(W,mask,thresh) exampleBW = imsegfmm(W,C,R,thresh)[BW,D] =
imsegfmm(___)```

Example

```Segment Image Using Fast Marching Method AlgorithmOpen This Example
This example shows how to segment an object in an image using Fast Marching Method based on differences in grayscale intensity as compared to the seed locations.
imshow(I)
title('Original Image')

Create mask and specify seed location. You can also use roipoly to create the mask interactively.mask = false(size(I));
Compute the weight array based on grayscale intensity differences.W = graydiffweight(I, mask, 'GrayDifferenceCutoff', 25);
Segment the image using the weights.thresh = 0.01;
[BW, D] = imsegfmm(W, mask, thresh);
figure
imshow(BW)
title('Segmented Image')

You can threshold the geodesic distance matrix D using different thresholds to get different segmentation results.figure
imshow(D)
title('Geodesic Distances')```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7893866,"math_prob":0.9540389,"size":2020,"snap":"2019-26-2019-30","text_gpt3_token_len":483,"char_repetition_ratio":0.12301587,"word_repetition_ratio":0.013793103,"special_character_ratio":0.21287128,"punctuation_ratio":0.12771739,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98221684,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-06-20T09:03:34Z\",\"WARC-Record-ID\":\"<urn:uuid:cc83823c-31f9-46b8-889b-6d494c9b7909>\",\"Content-Length\":\"8396\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:aff85918-b608-465d-9b7c-b297eb757528>\",\"WARC-Concurrent-To\":\"<urn:uuid:c540c123-a927-4097-8af4-561189d90376>\",\"WARC-IP-Address\":\"104.27.132.94\",\"WARC-Target-URI\":\"https://wikidev.in/wiki/matlab/image_processing/imsegfmm\",\"WARC-Payload-Digest\":\"sha1:WUBOUWVFKNVEP2JYPFR5OVYG5CVD5EL5\",\"WARC-Block-Digest\":\"sha1:UO6RUOUV6K6IJO2YYRIVJSRCP63D4L2K\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-26/CC-MAIN-2019-26_segments_1560627999200.89_warc_CC-MAIN-20190620085246-20190620111246-00553.warc.gz\"}"}