How do I use the global optimization tool box to find all local maxima in a matrix?

2 views (last 30 days)
I have a matrix of an simple gray-scale image that I'm trying to run a global optimization on (I want to find all of the local maxima). I am new to the global optimization tool box and am confused on how to do so. The toolbox seems to require a function rather than a data set. How do I continue?
The image began as a binary image of 9 small dots. I then ran a conv2d filter to identify the center of each dot. When graphed using a mesh graph, the dots appear as 9 pronounced peaks rising from a plane.

Accepted Answer

Image Analyst
Image Analyst on 4 Jan 2015
Why not simple use imregionalmax() in the Image Processing Toolbox? It's a simple one line of code.
imregionalmax
Regional maxima
Syntax
BW = imregionalmax(I)
BW = imregionalmax(I,conn)
Description
BW = imregionalmax(I) finds the regional maxima of I. imregionalmax returns the binary image BW that identifies the locations of the regional maxima in I. BW is the same size as I. In BW, pixels that are set to 1 identify regional maxima; all other pixels are set to 0.
Regional maxima are connected components of pixels with a constant intensity value, and whose external boundary pixels all have a lower value.
By default, imregionalmax uses 8-connected neighborhoods for 2-D images and 26-connected neighborhoods for 3-D images. For higher dimensions, imregionalmax uses conndef(ndims(I),'maximal').
BW = imregionalmax(I,conn) computes the regional maxima of I using the specified connectivity. conn can have any of the following scalar values.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!