Texture Inspection

List of Operators ↓

This chapter describes the operators for texture inspection.

Concept of the texture inspection model

The texture inspection model enables the inspection of textured surfaces with only having to set few parameters. The algorithm requires images of flawless texture for training. The training process extracts texture features from the training images and trains a texture inspection model that is based on Gaussian Mixture Model (GMM) classifiers. After a successful training, texture images can be compared to the texture inspection model and potential defects can be identified. Texture inspection works on image pyramids. This way, multiple frequency ranges of the texture are analyzed.

In the following, the steps that are required to perform the texture inspection are described briefly.

Create a texture inspection model:

In a first step, a texture inspection model is created with

or read with

Add training samples:

The operator

adds sample images to the texture inspection model.

Image of a textured surface that is used to train a texture inspection model.

Images that have been added to the texture inspection model with the help of add_texture_inspection_model_imageadd_texture_inspection_model_imageAddTextureInspectionModelImageAddTextureInspectionModelImageAddTextureInspectionModelImage can be viewed with get_texture_inspection_model_imageget_texture_inspection_model_imageGetTextureInspectionModelImageGetTextureInspectionModelImageGetTextureInspectionModelImage. If all or a part of the added images are not needed for the current texture inspection, they can be removed from the model using remove_texture_inspection_model_imageremove_texture_inspection_model_imageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImage.

Train a texture inspection model:

The texture inspection model is trained with

In the training process an image pyramid is created. For each pyramid level a Gaussian Mixture Model (GMM) is trained and a 'novelty_threshold'"novelty_threshold""novelty_threshold""novelty_threshold""novelty_threshold" is determined. The 'novelty_threshold'"novelty_threshold""novelty_threshold""novelty_threshold""novelty_threshold" helps to distinguish between flawless and defective texture. After the training, it is possible to query the novelty thresholds with get_texture_inspection_model_paramget_texture_inspection_model_paramGetTextureInspectionModelParamGetTextureInspectionModelParamGetTextureInspectionModelParam.

Several parameters influence the training. They can be set with

We recommend the following proceeding for the training:

Apply the texture inspection model:

After successfully training the texture inspection model it can be used to classify textured surfaces. Each test image can be compared to the texture inspection model with

Test image with defects.

For each test image the operator returns a 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region", which indicates where the image has high deviations to the trained texture samples. The 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region" is generated by combining the novelty regions of the different pyramid levels. 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". 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". If, for example, '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" is the novelty region of the first pyramid level.

For debugging, the parameter 'gen_result_handle'"gen_result_handle""gen_result_handle""gen_result_handle""gen_result_handle" can be set to 'true'"true""true""true""true" with set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParam. This way, the novelty score images and novelty regions of the individual pyramid levels are stored in a result handle. They can then be read with

In general, the novelty score images describe how well each pixel fits to the texture inspection model that was created within the training process. The novelty regions of the single pyramid levels are then calculated by applying the 'novelty_threshold'"novelty_threshold""novelty_threshold""novelty_threshold""novelty_threshold" to the corresponding novelty score images.

Inspecting the novelty score images and the novelty regions provides you with hints which kinds of errors are detectable on which pyramid levels. Thus, you can decide whether parameters for the training and the classification should be adjusted, e.g., whether it is reasonable to explicitly select only a subset of pyramid levels using the parameter 'levels'"levels""levels""levels""levels".

(1) (2)
The resulting 'novelty_score_image'"novelty_score_image""novelty_score_image""novelty_score_image""novelty_score_image" (1) and the resulting 'novelty_region'"novelty_region""novelty_region""novelty_region""novelty_region" (2) for the test image above.

Further operators

The functionality of the texture inspection can be altered by various parameters. The parameters can be queried with get_texture_inspection_model_paramget_texture_inspection_model_paramGetTextureInspectionModelParamGetTextureInspectionModelParamGetTextureInspectionModelParam and altered with calls to set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParam.

It is possible to write a texture inspection model to file with the operator write_texture_inspection_modelwrite_texture_inspection_modelWriteTextureInspectionModelWriteTextureInspectionModelWriteTextureInspectionModel. Thereby, only the texture inspection model is stored. The images which were possibly added can be queried with the help of get_texture_inspection_model_imageget_texture_inspection_model_imageGetTextureInspectionModelImageGetTextureInspectionModelImageGetTextureInspectionModelImage and stored separately by calling write_objectwrite_objectWriteObjectWriteObjectWriteObject.

To help reduce the memory required by the texture inspection model, it is possible to delete previously added images from the model with remove_texture_inspection_model_imageremove_texture_inspection_model_imageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImageRemoveTextureInspectionModelImage.

Furthermore, it is possible to serialize and deserialize the texture inspection model with serialize_texture_inspection_modelserialize_texture_inspection_modelSerializeTextureInspectionModelSerializeTextureInspectionModelSerializeTextureInspectionModel and deserialize_texture_inspection_modeldeserialize_texture_inspection_modelDeserializeTextureInspectionModelDeserializeTextureInspectionModelDeserializeTextureInspectionModel.


In the following, the most important terms that are used in the context of texture inspection are described:

Training images

Images that are used for training.

Test images

Images which are compared to the trained texture inspection model.


A collection of neighboring pixels.

Texture feature

Gray-values of the pixels within a patch.


A texture feature that is used for training.

Novelty Score

In the test process the texture features of the test images are compared to the texture inspection model and their 'novelty score'"novelty score""novelty score""novelty score""novelty score" is calculated. The larger this value, the more probable it is that the individual texture feature does not fit to the texture inspection model.

Novelty Threshold

The novelty threshold is determined during the training process. Texture features with a novelty score below the novelty threshold fit to the texture inspection model. Texture features with a higher novelty score do not.

List of Operators

Add training images to the texture inspection model.
Inspection of the texture within an image.
Clear a texture inspection model and free the allocated memory.
Clear a texture inspection result handle and free the allocated memory.
Create a texture inspection model.
Deserialize a serialized texture inspection model.
Get the training images contained in a texture inspection model.
Query parameters of a texture inspection model.
Query iconic results of a texture inspection.
Read a texture inspection model from a file.
Clear all or a user-defined subset of the images of a texture inspection model.
Serialize a texture inspection model.
Set parameters of a texture inspection model.
Train a texture inspection model.
Write a texture inspection model to a file.