Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB


Didja know about the Image Processing Toolbox function bwselect?

For a blog post I wrote earlier this month, I wanted a binary image containing only the central blob indicated in red below:

url = '';
bw = imread(url);
    'Position',[0.4931 0.463 0.07575 0.2029],...
    'Color',[0.8471 0.1608 0]);

The Image Processing Toolbox function bwselect is perfect for this task. You can use it interactively or noninteractively.

If you use the interactive syntax:

 bw2 = bwselect(bw)

the function displays bw and waits for you to click on the image with the mouse. You can click on one or multiple points. To finish your selection, double-click on the last point, or just press RETURN. bwselect then returns a binary image containing only the objects ("blobs") that you clicked on.

You can also use the noninteractive syntax, in which you pass in the point locations as input arguments instead of using the mouse.

For example:

pond = bwselect(bw, 183, 170);

I hope you find this function useful.

Published with MATLAB® 7.5

  • print
  • send email


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