Classify pixels using hyper-spheres or hyper-cubes.
::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 paramter must be set to the same value used in ::learn_ndim_norm. The parameter is used to determine whether one region ('single') or multiple regions ('multiple') have to be generated for each cluster. Radius determines the radii or half edge length of the clusters, respectively. Center determines their centers.
|
MultiChannelImage (input_object) |
multichannel-image(-array) -> Hobject: HImage(Array) ( byte / int1 / int2 / int4 / real ) |
| Multi-channel input image. | |
|
Regions (output_object) |
region-array -> Hobject * : HRegionArray |
| Segmentation result. | |
|
Metric (input_control) |
string -> HTuple.char * |
| Metric to be used. | |
| Default value: 'euclid' | |
| List of values: 'euclid', 'maximum' | |
|
SingleMultiple (input_control) |
string -> HTuple.char * |
| Return one region or one region for each cluster. | |
| Default value: 'single' | |
| List of values: 'single', 'multiple' | |
|
Radius (input_control) |
number(-array) -> HTuple.double / long |
| Cluster radii or half edge lengths (returned by ::learn_ndim_norm). | |
|
Center (input_control) |
number(-array) -> HTuple.double / long |
| Coordinates of the cluster centers (returned by ::learn_ndim_norm). | |
#include "HalconCpp.h"
#include <iostream.h>
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);
}
Let N be the number of clusters and F be the area of the input region. Then the runtime complexity is O(N * F).
::class_ndim_norm returns 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.
::learn_ndim_norm, ::compose2, ::compose3, ::compose4
::connection, ::select_shape, ::reduce_domain, ::select_gray
::class_ndim_box, ::class_2dim_sup
::disp_circle, ::disp_rectangle1
Region processing