Code covered by the BSD License  

Highlights from
Manual Thresholding Tool

4.5

4.5 | 3 ratings Rate this file 37 Downloads (last 30 days) File Size: 6.6 KB File ID: #28723
image thumbnail

Manual Thresholding Tool

by

 

16 Sep 2010 (Updated )

manual_thresh interactively select intensity levels band for image thresholding

| Watch this File

File Information
Description

manual_thresh interactively select intensity levels band for image thresholding.
The code is based on thresh_tool by Robert Bemis found in MATLAB CENTRAL (can be considered as an improved version of it) but it has some more features:
1. The possibility to choose a band of intensities rather than only the low threshold level.
2. Editable texts and sliders were added to facilitate the use.
3. The segmented image is displayed as a layer on the top of the original image which makes it easy to decide which pixels intensities have to be chosen.

use:
manual_thresh launches a GUI (graphical user interface) for thresholding an intensity input image, IM. IM is displayed in the top of the figure . A colorbar and IM's histogram are displayed on the bottom. Vertical lines on the histogram indicates the current threshold levels. The segmented image
  (with the intensity levels between the low and high threshold levels is displayed as a upper layer with transparent background on the top of the original image. To change the level, click and drag the lines or use the editable text or sliders. The output image updates automatically.

  There are two ways to use this tool.

Mode 1 - nonblocking behavior:
   manual_thresh (IM) launches GUI tool. You can continue using the MATLAB
  Desktop. Since no results are needed, the function does not block
  execution of other commands.

   manual_thresh (IM,CMAP) allows the user to specify the colormap, CMAP. If not specified, the default colormap is used.

   manual_thresh (IM,CMAP,DEFAULTLEVEL) allows the user to specify the default low threshold level. If not specified, DEFAULTLEVEL is determined by GRAYTHRESH. Valid values for DEFAULTLEVEL must be consistent with the data type of IM for integer intensity images: uint8 [0,255], uint16 [0,65535], int16 [-32768,32767].

  Example
      x = imread('coins.png');
      manual_thresh(x) %no return value, so MATLAB keeps running

Mode 2 - blocking behavior:
  [LOW LEVEL, HIGH LEVEL] = manual_thresh (...) returns the user selected levels, LOW LEVEL $ HIGH LEVEL, and
  MATLAB waits for the result before proceeding. This blocking behavior
  mode allows the tool to be inserted into an image processing algorithm
  to support an automated workflow.

  [LOW LEVEL, HIGH LEVEL,BW] = manual_thresh(...) also returns the thresholded binary
  output image, BW.

  Example
      x = imread('coins.png');
       [LOW LEVEL, HIGH LEVEL] = manual_thresh(x') %MATLAB waits for GUI tool to finish

Acknowledgements

Hline And Vline and Thresholding Tool inspired this file.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.0.1 (R14SP1)
Other requirements acknowledgements correction
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
17 Jul 2014 A Sez

I get "too many output arguments" error when using [LOW LEVEL, HIGH LEVEL] function

06 Feb 2014 ted p teng

Thanks for sharing!

18 May 2011 svetlana  
18 May 2011 svetlana  
Updates
19 Sep 2010

acknowledgements correction

Contact us