Operator Reference

learn_ndim_boxT_learn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box (Operator)

learn_ndim_boxT_learn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box — Train a classificator using a multi-channel image.

Warning

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

Signature

Herror T_learn_ndim_box(const Hobject Foreground, const Hobject Background, const Hobject MultiChannelImage, const Htuple ClassifHandle)

void LearnNdimBox(const HObject& Foreground, const HObject& Background, const HObject& MultiChannelImage, const HTuple& ClassifHandle)

void HImage::LearnNdimBox(const HRegion& Foreground, const HRegion& Background, const HClassBox& ClassifHandle) const

void HRegion::LearnNdimBox(const HRegion& Background, const HImage& MultiChannelImage, const HClassBox& ClassifHandle) const

void HClassBox::LearnNdimBox(const HRegion& Foreground, const HRegion& Background, const HImage& MultiChannelImage) const

def learn_ndim_box(foreground: HObject, background: HObject, multi_channel_image: HObject, classif_handle: HHandle) -> None

Description

learn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box trains the classificator ClassifHandleClassifHandleClassifHandleclassifHandleclassif_handle with the gray values of MultiChannelImageMultiChannelImageMultiChannelImagemultiChannelImagemulti_channel_image using the points in ForegroundForegroundForegroundforegroundforeground as training sample. The points in BackgroundBackgroundBackgroundbackgroundbackground are to be rejected by the classificator. The classificator trained thus can be used in class_ndim_boxclass_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box to segment multi-channel images. ForegroundForegroundForegroundforegroundforeground are the points that should be found, BackgroundBackgroundBackgroundbackgroundbackground contains the points that should not be found.

Each pixel is trained once during the training process. For points in ForegroundForegroundForegroundforegroundforeground the class “0” is used, while for BackgroundBackgroundBackgroundbackgroundbackground “1” is used. Pixels are trained by alternating points from ForegroundForegroundForegroundforegroundforeground with points from BackgroundBackgroundBackgroundbackgroundbackground. If one region is smaller than the other, pixels are taken cyclically from the smaller region until the larger region is exhausted. learn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box later accepts only points that can be classified into class “0”.

From a user's point of view the key difference between learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormlearn_ndim_norm and learn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box is that in the latter case the rejection class affects the classification process itself. Here, a hyper plane is generated that separates ForegroundForegroundForegroundforegroundforeground and BackgroundBackgroundBackgroundbackgroundbackground classes, so that no points in feature space are classified incorrectly. As for learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormlearn_ndim_norm, however, an overlap between ForegroundForegroundForegroundforegroundforeground and BackgroundBackgroundBackgroundbackgroundbackground class is allowed. This has its effect on the return value Quality. The larger the overlap, the smaller this value.

Attention

All channels must be of the same type.

Execution Information

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

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters

ForegroundForegroundForegroundforegroundforeground (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Foreground pixels to be trained.

BackgroundBackgroundBackgroundbackgroundbackground (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Background pixels to be trained (rejection class).

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

Multi-channel training image.

ClassifHandleClassifHandleClassifHandleclassifHandleclassif_handle (input_control, state is modified)  class_box HClassBox, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the classifier.

Complexity

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

Result

learn_ndim_boxlearn_ndim_boxLearnNdimBoxLearnNdimBoxlearn_ndim_box returns 2 ( H_MSG_TRUE) if all parameters are correct and there is an active classificator. The behavior with respect to the input images 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" and 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result" with set_systemset_systemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

create_class_boxcreate_class_boxCreateClassBoxCreateClassBoxcreate_class_box, draw_regiondraw_regionDrawRegionDrawRegiondraw_region

Possible Successors

class_ndim_boxclass_ndim_boxClassNdimBoxClassNdimBoxclass_ndim_box, descript_class_boxdescript_class_boxDescriptClassBoxDescriptClassBoxdescript_class_box

Alternatives

learn_class_boxlearn_class_boxLearnClassBoxLearnClassBoxlearn_class_box, learn_ndim_normlearn_ndim_normLearnNdimNormLearnNdimNormlearn_ndim_norm

Module

Foundation