class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm (Operator)

Name

class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm — Classify pixels using hyper-spheres or hyper-cubes.

Signature

class_ndim_norm(MultiChannelImage : Regions : Metric, SingleMultiple, Radius, Center : )

Herror class_ndim_norm(const Hobject MultiChannelImage, Hobject* Regions, const char* Metric, const char* SingleMultiple, double Radius, double Center)

Herror T_class_ndim_norm(const Hobject MultiChannelImage, Hobject* Regions, const Htuple Metric, const Htuple SingleMultiple, const Htuple Radius, const Htuple Center)

void ClassNdimNorm(const HObject& MultiChannelImage, HObject* Regions, const HTuple& Metric, const HTuple& SingleMultiple, const HTuple& Radius, const HTuple& Center)

HRegion HImage::ClassNdimNorm(const HString& Metric, const HString& SingleMultiple, const HTuple& Radius, const HTuple& Center) const

HRegion HImage::ClassNdimNorm(const HString& Metric, const HString& SingleMultiple, double Radius, double Center) const

HRegion HImage::ClassNdimNorm(const char* Metric, const char* SingleMultiple, double Radius, double Center) const

HRegion HImage::ClassNdimNorm(const wchar_t* Metric, const wchar_t* SingleMultiple, double Radius, double Center) const   (Windows only)

static void HOperatorSet.ClassNdimNorm(HObject multiChannelImage, out HObject regions, HTuple metric, HTuple singleMultiple, HTuple radius, HTuple center)

HRegion HImage.ClassNdimNorm(string metric, string singleMultiple, HTuple radius, HTuple center)

HRegion HImage.ClassNdimNorm(string metric, string singleMultiple, double radius, double center)

def class_ndim_norm(multi_channel_image: HObject, metric: str, single_multiple: str, radius: MaybeSequence[Union[int, float]], center: MaybeSequence[Union[int, float]]) -> HObject

Description

class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm classifies the pixels of the multi-channel image given in MultiChannelImageMultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image. The result is returned in RegionsRegionsRegionsRegionsregionsregions as one region per classification object. The metric used ('euclid'"euclid""euclid""euclid""euclid""euclid" or 'maximum'"maximum""maximum""maximum""maximum""maximum") is determined by MetricMetricMetricMetricmetricmetric. This parameter must be set to the same value used in learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormLearnNdimNormlearn_ndim_norm. The parameter SingleMultipleSingleMultipleSingleMultipleSingleMultiplesingleMultiplesingle_multiple determines whether one region ('single') or multiples regions ('multiple') are generated for each cluster. RadiusRadiusRadiusRadiusradiusradius determines the radii or half edge length of the clusters, respectively. CenterCenterCenterCentercentercenter determines their centers.

Execution Information

Parameters

MultiChannelImageMultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image (input_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte)

Multi channel input image.

RegionsRegionsRegionsRegionsregionsregions (output_object)  region-array objectHRegionHObjectHRegionHobject *

Classification result.

MetricMetricMetricMetricmetricmetric (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Metric to be used.

Default value: 'euclid' "euclid" "euclid" "euclid" "euclid" "euclid"

List of values: 'euclid'"euclid""euclid""euclid""euclid""euclid", 'maximum'"maximum""maximum""maximum""maximum""maximum"

SingleMultipleSingleMultipleSingleMultipleSingleMultiplesingleMultiplesingle_multiple (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Return one region or one region for each cluster.

Default value: 'single' "single" "single" "single" "single" "single"

List of values: 'multiple'"multiple""multiple""multiple""multiple""multiple", 'single'"single""single""single""single""single"

RadiusRadiusRadiusRadiusradiusradius (input_control)  number(-array) HTupleMaybeSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Cluster radii or half edge lengths (returned by learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormLearnNdimNormlearn_ndim_norm).

CenterCenterCenterCentercentercenter (input_control)  number(-array) HTupleMaybeSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Coordinates of the cluster centers (returned by learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormLearnNdimNormlearn_ndim_norm).

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 ()
{
  HImage   image ("meer"),
           t1, t2, t3,
           m1, m2, m3, m;

  HWindow  w;

  w.SetColor ("green");
  image.Display (w);

  cout << "Draw your region of interest " << endl;

  HRegion testreg = w.DrawRegion ();

  t1 = image.TextureLaws ("el", 2, 5);     m1 = t1.MeanImage (21, 21);
  t2 = image.TextureLaws ("es", 2, 5);     m2 = t2.MeanImage (21, 21);
  t3 = image.TextureLaws ("le", 2, 5);     m3 = t3.MeanImage (21, 21);

  m  = m1.Compose3 (m2, m3);

  Tuple Metric = "euclid";
  Tuple Radius = 20.0;
  Tuple MinNum = 5;
  Tuple NbrCha = 3;

  HRegion empty;
  Tuple cen, t;

  Radius = testreg.LearnNdimNorm (empty, m, Metric, Radius,
                                  MinNum, NbrCha, &cen, &t);
  Tuple RegMod = "multiple";

  HRegionArray reg = m.ClassNdimNorm (Metric, RegMod, Radius, cen, NbrCha);

  w.SetColored (12);
  reg.Display (w);
  cout << "Result of classification" << endl;
  return (0);
}

Example (C)

read_image(&Image,"meer:);
open_window(0,0,-1,-1,0,"visible","",&WindowHandle);
disp_image(Image,WindowHandle);
fwrite_string("draw region of interest with the mouse");
fnew_line();
set_color(WindowHandle,"green");
draw_region(&Testreg,draw_region);
/* Texture transformation for 3-dimensional charachteristic */
texture_laws(Image,&T1,"el",2,5);
mean_image(T1,&M1,21,21);
texture_laws(Image,&T2,"es",2,5);
mean_image(T2,&M2,21,21);
texture_laws(Image,&T3,"le",2,5);
mean_image(T3,&M3,21,21);
compose3(M1,M2,M3,&M);
/* Cluster for 3-dimensional characteristic area determine training area */
create_tuple(&Metric,1);
set_s(Metric,"euclid",0);
create_tuple(&Radius,1);
set_d(Radius,20.0,0);
create_tuple(&MinNumber,1);
set_i(MinNumber,5,0);
T_learn_ndim_norm(Testobj,EMPTY_REGION,&M,"euclid",Radius,MinNumber,
                  &Radius,&Center,NULL);
/* Segmentation */
create_tuple(&RegionMode,1);
set_s(RegionMode,"multiple",0);
class_ndim_norm(M,&Regions,Metric,RegionMode,Radius,Center);
set_colored(WindowHandle,12);
disp_region(Regions,WindowHandle);
fwrite_string("Result of classification;");
fwrite_string("Each cluster in another color.");
fnew_line();

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 ()
{
  HImage   image ("meer"),
           t1, t2, t3,
           m1, m2, m3, m;

  HWindow  w;

  w.SetColor ("green");
  image.Display (w);

  cout << "Draw your region of interest " << endl;

  HRegion testreg = w.DrawRegion ();

  t1 = image.TextureLaws ("el", 2, 5);     m1 = t1.MeanImage (21, 21);
  t2 = image.TextureLaws ("es", 2, 5);     m2 = t2.MeanImage (21, 21);
  t3 = image.TextureLaws ("le", 2, 5);     m3 = t3.MeanImage (21, 21);

  m  = m1.Compose3 (m2, m3);

  Tuple Metric = "euclid";
  Tuple Radius = 20.0;
  Tuple MinNum = 5;
  Tuple NbrCha = 3;

  HRegion empty;
  Tuple cen, t;

  Radius = testreg.LearnNdimNorm (empty, m, Metric, Radius,
                                  MinNum, NbrCha, &cen, &t);
  Tuple RegMod = "multiple";

  HRegionArray reg = m.ClassNdimNorm (Metric, RegMod, Radius, cen, NbrCha);

  w.SetColored (12);
  reg.Display (w);
  cout << "Result of classification" << endl;
  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 ()
{
  HImage   image ("meer"),
           t1, t2, t3,
           m1, m2, m3, m;

  HWindow  w;

  w.SetColor ("green");
  image.Display (w);

  cout << "Draw your region of interest " << endl;

  HRegion testreg = w.DrawRegion ();

  t1 = image.TextureLaws ("el", 2, 5);     m1 = t1.MeanImage (21, 21);
  t2 = image.TextureLaws ("es", 2, 5);     m2 = t2.MeanImage (21, 21);
  t3 = image.TextureLaws ("le", 2, 5);     m3 = t3.MeanImage (21, 21);

  m  = m1.Compose3 (m2, m3);

  Tuple Metric = "euclid";
  Tuple Radius = 20.0;
  Tuple MinNum = 5;
  Tuple NbrCha = 3;

  HRegion empty;
  Tuple cen, t;

  Radius = testreg.LearnNdimNorm (empty, m, Metric, Radius,
                                  MinNum, NbrCha, &cen, &t);
  Tuple RegMod = "multiple";

  HRegionArray reg = m.ClassNdimNorm (Metric, RegMod, Radius, cen, NbrCha);

  w.SetColored (12);
  reg.Display (w);
  cout << "Result of classification" << endl;
  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 ()
{
  HImage   image ("meer"),
           t1, t2, t3,
           m1, m2, m3, m;

  HWindow  w;

  w.SetColor ("green");
  image.Display (w);

  cout << "Draw your region of interest " << endl;

  HRegion testreg = w.DrawRegion ();

  t1 = image.TextureLaws ("el", 2, 5);     m1 = t1.MeanImage (21, 21);
  t2 = image.TextureLaws ("es", 2, 5);     m2 = t2.MeanImage (21, 21);
  t3 = image.TextureLaws ("le", 2, 5);     m3 = t3.MeanImage (21, 21);

  m  = m1.Compose3 (m2, m3);

  Tuple Metric = "euclid";
  Tuple Radius = 20.0;
  Tuple MinNum = 5;
  Tuple NbrCha = 3;

  HRegion empty;
  Tuple cen, t;

  Radius = testreg.LearnNdimNorm (empty, m, Metric, Radius,
                                  MinNum, NbrCha, &cen, &t);
  Tuple RegMod = "multiple";

  HRegionArray reg = m.ClassNdimNorm (Metric, RegMod, Radius, cen, NbrCha);

  w.SetColored (12);
  reg.Display (w);
  cout << "Result of classification" << endl;
  return (0);
}

Complexity

Let N be the number of clusters and A be the area of the input region. Then the runtime complexity is O(N,A).

Result

class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior with respect to the input images and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result""empty_region_result", and 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemSetSystemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormLearnNdimNormlearn_ndim_norm, compose2compose2Compose2Compose2Compose2compose2, compose3compose3Compose3Compose3Compose3compose3, compose4compose4Compose4Compose4Compose4compose4, compose5compose5Compose5Compose5Compose5compose5, compose6compose6Compose6Compose6Compose6compose6, compose7compose7Compose7Compose7Compose7compose7

Possible Successors

connectionconnectionConnectionConnectionConnectionconnection, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_grayselect_graySelectGraySelectGraySelectGrayselect_gray

Alternatives

class_2dim_supclass_2dim_supClass2dimSupClass2dimSupClass2dimSupclass_2dim_sup, class_2dim_unsupclass_2dim_unsupClass2dimUnsupClass2dimUnsupClass2dimUnsupclass_2dim_unsup

Module

Foundation