apply_texture_inspection_model — Inspection of the texture within an image.
The operator apply_texture_inspection_model compares Image with the trained texture inspection model TextureInspectionModel. Image can either be a single gray-value image or a tuple of gray-value images. Pixels that do not fit to the texture inspection model are returned in NoveltyRegion. Furthermore, if 'gen_result_handle' has been set to 'true' with set_texture_inspection_model_param, the operator also returns the result handle TextureInspectionResultID with more detailed information on the texture classification. If 'gen_result_handle' is set to 'false', TextureInspectionResultID 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 NoveltyRegion. 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'. If a pyramid level has no adjacent pyramid level the region itself is added to the 'novelty_region'. If, for example, 'num_levels' is set to 1, no adjacent pyramid level exists and the 'novelty_region' is the novelty region of the first pyramid level.
If 'gen_result_handle' is set to 'true', the result handle TextureInspectionResultID 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_object.
When the result handle is no longer required, it should be cleared with the operator clear_texture_inspection_result.
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:
Image of the texture to be inspected.
Handle of the texture inspection model.
Handle of the inspection results.
* 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) * Clean up clear_texture_inspection_model (TextureInspectionModel) clear_texture_inspection_result (TextureInspectionResultID)
The operator apply_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.
get_texture_inspection_result_object, get_texture_inspection_model_param, clear_texture_inspection_result, clear_texture_inspection_model