local_maxlocal_maxLocalMaxLocalMaxlocal_max (Operator)
Name
local_maxlocal_maxLocalMaxLocalMaxlocal_max — Detect all local maxima in an image.
Signature
def local_max(image: HObject) -> HObject
 
Description
local_maxlocal_maxLocalMaxLocalMaxLocalMaxlocal_max extracts all points from ImageImageImageImageimageimage having a gray
value larger than the gray value of all its neighbors and returns them in
LocalMaximaLocalMaximaLocalMaximaLocalMaximalocalMaximalocal_maxima. The neighborhood used can be set by
set_system(::'neighborhood',<4/8>)set_system("neighborhood",<4/8>)SetSystem("neighborhood",<4/8>)SetSystem("neighborhood",<4/8>)SetSystem("neighborhood",<4/8>)set_system("neighborhood",<4/8>).
Execution Information
  - Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Parameters
  
ImageImageImageImageimageimage (input_object)  singlechannelimage(-array) → objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)
 
Input image.
 
  
LocalMaximaLocalMaximaLocalMaximaLocalMaximalocalMaximalocal_maxima (output_object)  region(-array) → objectHRegionHObjectHRegionHobject *
 
Extracted local maxima as a region.
Number of elements:
      LocalMaxima == Image
 
Example (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
  using namespace Halcon;
  if (argc != 2)
  {
    cout << "Usage : " << argv[0] << " <name of image>" << endl;
    return (-1);
  }
  HImage   image (argv[1]);
  HWindow  win;
  image.Display (win);
  HImage       cres = image.CornerResponse (5, 0.04);
  HRegionArray maxi = cres.LocalMax ();
  win.SetColored (12);
  maxi.Display (win);
  win.Click ();
  return (0);
}
 
Example (C)
read_image(&Image,"fabrik");
corner_responce(Image,&CornerResp,5,0.04);
local_max(CornerResp,&Maxima);
set_colored(WindowHandle,12);
disp_region(Maxima,WindowHandle);
T_get_region_points(Maxima,&Row,&Col);
 
Example (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
  using namespace Halcon;
  if (argc != 2)
  {
    cout << "Usage : " << argv[0] << " <name of image>" << endl;
    return (-1);
  }
  HImage   image (argv[1]);
  HWindow  win;
  image.Display (win);
  HImage       cres = image.CornerResponse (5, 0.04);
  HRegionArray maxi = cres.LocalMax ();
  win.SetColored (12);
  maxi.Display (win);
  win.Click ();
  return (0);
}
 
Example (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
  using namespace Halcon;
  if (argc != 2)
  {
    cout << "Usage : " << argv[0] << " <name of image>" << endl;
    return (-1);
  }
  HImage   image (argv[1]);
  HWindow  win;
  image.Display (win);
  HImage       cres = image.CornerResponse (5, 0.04);
  HRegionArray maxi = cres.LocalMax ();
  win.SetColored (12);
  maxi.Display (win);
  win.Click ();
  return (0);
}
 
Example (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
  using namespace Halcon;
  if (argc != 2)
  {
    cout << "Usage : " << argv[0] << " <name of image>" << endl;
    return (-1);
  }
  HImage   image (argv[1]);
  HWindow  win;
  image.Display (win);
  HImage       cres = image.CornerResponse (5, 0.04);
  HRegionArray maxi = cres.LocalMax ();
  win.SetColored (12);
  maxi.Display (win);
  win.Click ();
  return (0);
}
 
Possible Predecessors
binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, 
gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, 
smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image
Possible Successors
get_region_pointsget_region_pointsGetRegionPointsGetRegionPointsGetRegionPointsget_region_points, 
connectionconnectionConnectionConnectionConnectionconnection
Alternatives
nonmax_suppression_ampnonmax_suppression_ampNonmaxSuppressionAmpNonmaxSuppressionAmpNonmaxSuppressionAmpnonmax_suppression_amp, 
plateausplateausPlateausPlateausPlateausplateaus, 
plateaus_centerplateaus_centerPlateausCenterPlateausCenterPlateausCenterplateaus_center
See also
monotonymonotonyMonotonyMonotonyMonotonymonotony, 
topographic_sketchtopographic_sketchTopographicSketchTopographicSketchTopographicSketchtopographic_sketch, 
corner_responsecorner_responseCornerResponseCornerResponseCornerResponsecorner_response, 
texture_lawstexture_lawsTextureLawsTextureLawsTextureLawstexture_laws
Module
Foundation