File Exchange

image thumbnail


version 1.0 (20.2 KB) by

A bot to segment foreground from background using a basic blur+threshold+watershed algorithm.



View License

A bot to segment foreground from background using a basic three-step algorithm:
> blurring
> thresholding
> watershed to split touching objects
Usage: call 'thresholdSegmentationBot' and follow the instructions.

If you have image data already loaded as a double, grayscale, range [0,1] image I,
use thresholdSegmentationTool as in the example below:

I = imread('rice.png');
I = double(I)/255;
I = imtophat(I,strel('disk',12,0')); % background subtraction
TST = thresholdSegmentationTool(I);
% use tool, then click 'Done Setting Parameters'

The final segmentation mask can then be accessed at TST.FinalMask,
and the segmentation model at TST.ThrModel.

The threshold models can be passed to
thresholdSegmentationHeadlessBot for batch processing.

call siameseThresholdSegmentationBot for a version that admits two images side by side.
This can be used to test the same set of parameters in two images simultaneously.
siameseThresholdSegmentationHeadlessBot is the corresponding function for batch processing.


Video tutorial:

Sample data:


MatBots are primitive AIs, 'assistants' if you will, that use minimalistic GUI dialogs to guide the user through a data processing pipeline in Matlab.

Isn't that an 'app'? Bots are much more restrictive than apps. Users are, to a greater extent than in an app, guided through the correct steps to perform a task. A bot usually performs a much more limited task than an app.

When possible, bots have a 'headless' mode, which allows them to execute a processing pipeline as a typical Matlab function, either on an image or a folder of images.

For more bots and tools for bio-image analysis, see

Comments and Ratings (0)

MATLAB Release
MATLAB 9.2 (R2017a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video