Main Content

Find Local Maxima in Image

This example shows you how to find local maxima in an image.

Example Model

Open the Simulink® model.

modelname = 'ex_blkLocalMaxima.slx';
open_system(modelname)

The model reads an RGB input image from a file using the Image From File block, and then converts it to an intensity image using the Color Space Conversion block. The Find Local Maxima block with Neighborhood size parameter of [75 75], finds two local maxima in the intensity image. The Draw Markers block then draws the locations of the detected local maxima on the input image.

Simulate and Display Results

Run the model. The model displays the input image and the output image using Video Viewer blocks. Notice that the Find Local Maxima block indicates that the two brightest pixels correspond to the headlights of the front car in the input image.

sim(modelname);