apply_texture_inspection_modelT_apply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model (Operator)

Name

apply_texture_inspection_modelT_apply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model — Inspection of the texture within an image.

Signature

apply_texture_inspection_model(Image : NoveltyRegion : TextureInspectionModel : TextureInspectionResultID)

Herror T_apply_texture_inspection_model(const Hobject Image, Hobject* NoveltyRegion, const Htuple TextureInspectionModel, Htuple* TextureInspectionResultID)

void ApplyTextureInspectionModel(const HObject& Image, HObject* NoveltyRegion, const HTuple& TextureInspectionModel, HTuple* TextureInspectionResultID)

HRegion HImage::ApplyTextureInspectionModel(const HTextureInspectionModel& TextureInspectionModel, HTextureInspectionResult* TextureInspectionResultID) const

HRegion HTextureInspectionModel::ApplyTextureInspectionModel(const HImage& Image, HTextureInspectionResult* TextureInspectionResultID) const

void HTextureInspectionResult::HTextureInspectionResult(const HImage& Image, HRegion* NoveltyRegion, const HTextureInspectionModel& TextureInspectionModel)

HRegion HTextureInspectionResult::ApplyTextureInspectionModel(const HImage& Image, const HTextureInspectionModel& TextureInspectionModel)

static void HOperatorSet.ApplyTextureInspectionModel(HObject image, out HObject noveltyRegion, HTuple textureInspectionModel, out HTuple textureInspectionResultID)

HRegion HImage.ApplyTextureInspectionModel(HTextureInspectionModel textureInspectionModel, out HTextureInspectionResult textureInspectionResultID)

HRegion HTextureInspectionModel.ApplyTextureInspectionModel(HImage image, out HTextureInspectionResult textureInspectionResultID)

public HTextureInspectionResult(HImage image, out HRegion noveltyRegion, HTextureInspectionModel textureInspectionModel)

HRegion HTextureInspectionResult.ApplyTextureInspectionModel(HImage image, HTextureInspectionModel textureInspectionModel)

def apply_texture_inspection_model(image: HObject, texture_inspection_model: HHandle) -> Tuple[HObject, HHandle]

Description

The operator apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model compares ImageImageImageImageimageimage with the trained texture inspection model TextureInspectionModelTextureInspectionModelTextureInspectionModelTextureInspectionModeltextureInspectionModeltexture_inspection_model. ImageImageImageImageimageimage can either be a single image or a tuple of images. It is possible to pass either gray-scale or multichannel images. Hereby, the operator expects that the passed ImageImageImageImageimageimage has the same number of channels than the model was trained with. The runtime of the apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model scales roughly linearly with the number of image channels. However, models using colored images are generally better at detecting colored texture defects.

Pixels that do not fit to the texture inspection model are returned in NoveltyRegionNoveltyRegionNoveltyRegionNoveltyRegionnoveltyRegionnovelty_region. Furthermore, if 'gen_result_handle'"gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle" has been set to 'true'"true""true""true""true""true" with set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param, the operator also returns the result handle TextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDtextureInspectionResultIDtexture_inspection_result_id with more detailed information on the texture classification. If 'gen_result_handle'"gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle" is set to 'false'"false""false""false""false""false", TextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDtextureInspectionResultIDtexture_inspection_result_id is empty.

For an explanation of the concept of the texture inspection see the introduction of chapter Inspection / Texture Inspection.

For each pyramid level texture features are extracted and classified with the corresponding GMM classifier. The resulting novelty score is then compared to the novelty threshold of the current pyramid level and classified as defective or not. The defective pixels are collected in a novelty region for each pyramid level. These novelty regions are then combined to the final novelty region returned in NoveltyRegionNoveltyRegionNoveltyRegionNoveltyRegionnoveltyRegionnovelty_region. The novelty regions of adjacent levels in the image pyramid are intersected with each other. This step helps to improve the robustness towards noise within the single pyramid level responses. The intersected novelty regions are then added to the returned 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region""novelty_region". If a pyramid level has no adjacent pyramid level the region itself is added to the 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region""novelty_region". If, for example, 'num_levels'"num_levels""num_levels""num_levels""num_levels""num_levels" is set to 1, no adjacent pyramid level exists and the 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region""novelty_region" is the novelty region of the first pyramid level.

If 'gen_result_handle'"gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle" is set to 'true'"true""true""true""true""true", the result handle TextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDtextureInspectionResultIDtexture_inspection_result_id contains novelty score images and the resulting novelty regions for each pyramid level.

This information is useful for debugging and fine tuning of the model parameters (e.g., the novelty thresholds) and can be accessed with get_texture_inspection_result_objectget_texture_inspection_result_objectGetTextureInspectionResultObjectGetTextureInspectionResultObjectGetTextureInspectionResultObjectget_texture_inspection_result_object.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

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

ImageImageImageImageimageimage (input_object)  (multichannel-)image-array objectHImageHObjectHImageHobject (byte / uint2 / real)

Image of the texture to be inspected.

NoveltyRegionNoveltyRegionNoveltyRegionNoveltyRegionnoveltyRegionnovelty_region (output_object)  region-array objectHRegionHObjectHRegionHobject *

Novelty regions.

TextureInspectionModelTextureInspectionModelTextureInspectionModelTextureInspectionModeltextureInspectionModeltexture_inspection_model (input_control)  texture_inspection_model HTextureInspectionModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the texture inspection model.

TextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDTextureInspectionResultIDtextureInspectionResultIDtexture_inspection_result_id (output_control, state is modified)  texture_inspection_result HTextureInspectionResult, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the inspection results.

Example (HDevelop)

* Create texture inspection model
create_texture_inspection_model ('basic', TextureInspectionModel)
* Set parameters
set_texture_inspection_model_param (TextureInspectionModel, \
                                    'gen_result_handle', 'true')
* Make this short example fast:
set_texture_inspection_model_param (TextureInspectionModel, \
                                    'gmm_em_max_iter', 1)
* Read and add training images
read_image (TrainImage, 'carpet/carpet_01')
add_texture_inspection_model_image (TrainImage, TextureInspectionModel, \
                                    Indices)
* Train the model
train_texture_inspection_model (TextureInspectionModel)
* Read and apply a test image
read_image (TestImage, 'carpet/carpet_02')
apply_texture_inspection_model (TestImage, DefectCandidates, \
                                TextureInspectionModel, \
                                TextureInspectionResultID)

Result

The operator apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model returns the value 2 (H_MSG_TRUE) if the given parameters are valid and within acceptable range. Otherwise, an exception will be raised.

Possible Predecessors

train_texture_inspection_modeltrain_texture_inspection_modelTrainTextureInspectionModelTrainTextureInspectionModelTrainTextureInspectionModeltrain_texture_inspection_model

Possible Successors

get_texture_inspection_result_objectget_texture_inspection_result_objectGetTextureInspectionResultObjectGetTextureInspectionResultObjectGetTextureInspectionResultObjectget_texture_inspection_result_object, get_texture_inspection_model_paramget_texture_inspection_model_paramGetTextureInspectionModelParamGetTextureInspectionModelParamGetTextureInspectionModelParamget_texture_inspection_model_param, clear_texture_inspection_resultclear_texture_inspection_resultClearTextureInspectionResultClearTextureInspectionResultClearTextureInspectionResultclear_texture_inspection_result, clear_texture_inspection_modelclear_texture_inspection_modelClearTextureInspectionModelClearTextureInspectionModelClearTextureInspectionModelclear_texture_inspection_model

Module

Matching