Operator Reference

class_ndim_boxT_class_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box (Operator)

class_ndim_boxT_class_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box — Classify pixels using hyper-cuboids.

Warning

class_ndim_boxclass_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box is obsolete and is only provided for reasons of backward compatibility. The operator will be removed with HALCON 25.11.

Signature

class_ndim_box(MultiChannelImage : Regions : ClassifHandle : )

Herror T_class_ndim_box(const Hobject MultiChannelImage, Hobject* Regions, const Htuple ClassifHandle)

void ClassNdimBox(const HObject& MultiChannelImage, HObject* Regions, const HTuple& ClassifHandle)

HRegion HImage::ClassNdimBox(const HClassBox& ClassifHandle) const

HRegion HClassBox::ClassNdimBox(const HImage& MultiChannelImage) const

def class_ndim_box(multi_channel_image: HObject, classif_handle: HHandle) -> HObject

Description

class_ndim_boxclass_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box classifies the pixels of the multi-channel image given in MultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image. To do so, the classificator ClassifHandleClassifHandleClassifHandleclassifHandleclassif_handle created with create_class_boxcreate_class_boxCreateClassBoxCreateClassBoxcreate_class_box is used. The classificator can be trained using learn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box or as described with create_class_boxcreate_class_boxCreateClassBoxCreateClassBoxcreate_class_box. More information on the structure of the classificator can be found also under that operator.

MultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image is a multi channel image. Its pixel values are used for the classification.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

MultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte / direction / cyclic / int1 / int2 / int4 / real)

Multi channel input image.

RegionsRegionsRegionsregionsregions (output_object)  region-array objectHRegionHObjectHObjectHobject *

Classification result.

ClassifHandleClassifHandleClassifHandleclassifHandleclassif_handle (input_control)  class_box HClassBox, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the classifier.

Example (HDevelop)

read_image(Image,'montery')
dev_display(Image)
dev_set_color('green')
disp_message (WindowHandle, 'Draw learning region  ',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg1,WindowHandle)
reduce_domain(Image,Reg1,Foreground)
dev_set_color('red')
disp_message (WindowHandle, 'Draw background region',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg2,WindowHandle)
reduce_domain(Image,Reg2,Background)
disp_message (WindowHandle, 'Training...           ',\
              'window', 12, 12, 'black', 'true')
create_class_box(ClassifHandle)
learn_ndim_box(Foreground,Background,Image,ClassifHandle)
disp_message (WindowHandle, 'Classification        ',\
              'window', 12, 12, 'black', 'true')
class_ndim_box(Image,Res,ClassifHandle)
dev_set_draw('fill')
dev_display (Res)
close_class_box(ClassifHandle)

Example (C)

read_image(&Image,"montery");
disp_image(Image,WindowHandle);
set_color(WindowHandle,"green");
fwrite_string(FileHandle,"Draw the foreground");
fnew_line(FileHandle);
draw_region(&Reg1,WindowHandle);
reduce_domain(Image,Reg1,&Foreground);
set_color(WindowHandle,"red");
fwrite_string(FileHandle,"Draw background");
fnew_line(FileHandle);
draw_region(&Reg2,WindowHandle);
reduce_domain(Image,Reg2,&Background);
fwrite_string(FileHandle,"Start to learn");
fnew_line(FileHandle);
create_class_box(&ClassifHandle);
learn_ndim_box(Foreground,Background,Image,ClassifHandle);
fwrite_string(FileHandle,"Start classification");
fnew_line(FileHandle);
class_ndim_box(Image,&Res,ClassifHandle);
set_draw(WindowHandle,"fill");
disp_region(Res,WindowHandle);
close_class_box(ClassifHandle);

Example (HDevelop)

read_image(Image,'montery')
dev_display(Image)
dev_set_color('green')
disp_message (WindowHandle, 'Draw learning region  ',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg1,WindowHandle)
reduce_domain(Image,Reg1,Foreground)
dev_set_color('red')
disp_message (WindowHandle, 'Draw background region',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg2,WindowHandle)
reduce_domain(Image,Reg2,Background)
disp_message (WindowHandle, 'Training...           ',\
              'window', 12, 12, 'black', 'true')
create_class_box(ClassifHandle)
learn_ndim_box(Foreground,Background,Image,ClassifHandle)
disp_message (WindowHandle, 'Classification        ',\
              'window', 12, 12, 'black', 'true')
class_ndim_box(Image,Res,ClassifHandle)
dev_set_draw('fill')
dev_display (Res)
close_class_box(ClassifHandle)

Example (HDevelop)

read_image(Image,'montery')
dev_display(Image)
dev_set_color('green')
disp_message (WindowHandle, 'Draw learning region  ',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg1,WindowHandle)
reduce_domain(Image,Reg1,Foreground)
dev_set_color('red')
disp_message (WindowHandle, 'Draw background region',\
              'window', 12, 12, 'black', 'true')
draw_region(Reg2,WindowHandle)
reduce_domain(Image,Reg2,Background)
disp_message (WindowHandle, 'Training...           ',\
              'window', 12, 12, 'black', 'true')
create_class_box(ClassifHandle)
learn_ndim_box(Foreground,Background,Image,ClassifHandle)
disp_message (WindowHandle, 'Classification        ',\
              'window', 12, 12, 'black', 'true')
class_ndim_box(Image,Res,ClassifHandle)
dev_set_draw('fill')
dev_display (Res)
close_class_box(ClassifHandle)

Complexity

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

Result

class_ndim_boxclass_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box 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", '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" with set_systemset_systemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

create_class_boxcreate_class_boxCreateClassBoxCreateClassBoxcreate_class_box, learn_class_boxlearn_class_boxLearnClassBoxLearnClassBoxlearn_class_box, median_imagemedian_imageMedianImageMedianImagemedian_image, compose2compose2Compose2Compose2compose2, compose3compose3Compose3Compose3compose3, compose4compose4Compose4Compose4compose4, compose5compose5Compose5Compose5compose5, compose6compose6Compose6Compose6compose6, compose7compose7Compose7Compose7compose7

Alternatives

class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm, class_2dim_supclass_2dim_supClass2dimSupClass2dimSupclass_2dim_sup, class_2dim_unsupclass_2dim_unsupClass2dimUnsupClass2dimUnsupclass_2dim_unsup

See also

descript_class_boxdescript_class_boxDescriptClassBoxDescriptClassBoxdescript_class_box

Module

Foundation