File Exchange Pick of the Week

Our best user submissions

Finding the right threshold value

The Image Processing Toolbox, which was introduced over ten years ago, is one of the most popular of The MathWorks’ Toolboxes, reflecting the breadth of industries in which image analysis plays a role. Most of us who have done significant work with the Toolbox over the years can point to numerous instances in which we wanted the ability to manipulate our images interactively, and to see the results of our changes as we made them. Bob Bemis’s thresh_tool provides just such functionality for interactively selecting a threshold level for reducing an image to binary form.

Bob’s code is slick; it automatically generates a histogram of the input image, along with a slider-like interface for moving the threshold level along the histogram axis. As you move the slider line, another axes automatically updates to show the result of thresholding at the selected level. Thresh_tool provides an easy way to use the code with either modal or non-modal behavior, supports user-selected colormaps, and can output both the user-selected level and the binary image it produces.

One of the nicest things about thresh_tool is that it is well-documented, and serves well as a model for the implementation of other interactive tools. Bob is a MATLAB and IPT guru, and I strongly encourage would-be developers to take a look at his implementation of this nice interactive GUI.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.