class_ndim_norm🔗
Short description🔗
class_ndim_norm — Classify pixels using hyper-spheres or hyper-cubes.
Signature🔗
class_ndim_norm( image MultiChannelImage, out region Regions, string Metric, string SingleMultiple, number Radius, number Center )
Description🔗
class_ndim_norm classifies the pixels of the multi-channel
image given in MultiChannelImage. The result is returned
in Regions as one region per classification object. The
metric used ('euclid' or 'maximum') is determined by
Metric. This parameter must be set to the same value used
in learn_ndim_norm. The parameter SingleMultiple
determines whether one region ('single') or multiples regions
('multiple') are generated for each cluster.
Radius determines the
radii or half edge length of the clusters, respectively.
Center determines their centers.
Execution information🔗
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🔗
MultiChannelImage (input_object) (multichannel-)image(-array) → object (byte)
Multi channel input image.
Regions (output_object) region-array → object
Classification result.
Metric (input_control) string → (string)
Metric to be used.
Default: 'euclid'
List of values: 'euclid', 'maximum'
SingleMultiple (input_control) string → (string)
Return one region or one region for each cluster.
Default: 'single'
List of values: 'multiple', 'single'
Radius (input_control) number(-array) → (real / integer)
Cluster radii or half edge lengths (returned by
learn_ndim_norm).
Center (input_control) number(-array) → (real / integer)
Coordinates of the cluster centers (returned by
learn_ndim_norm).
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()\;
#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_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', 'empty_region_result', and
'store_empty_region' with set_system.
If necessary, an exception is raised.
Combinations with other operators🔗
Combinations
Possible predecessors
learn_ndim_norm, compose2, compose3, compose4, compose5, compose6, compose7
Possible successors
connection, select_shape, reduce_domain, select_gray
Alternatives
Module🔗
Foundation