Operators |
set_structured_light_model_param — Set parameters of a structured light model.
set_structured_light_model_param( : : StructuredLightModel, GenParamName, GenParamValue : )
The operator set_structured_light_model_param is used to manipulate the parameters of a structured light model StructuredLightModel. The current parameter settings can be queried with the operator get_structured_light_model_param.
For an explanation of the concept of structured light and its supported applications, see the introduction of chapter Inspection / Structured Light.
General parameters:
Enables (GenParamValue='true' ) or disables (GenParamValue='false' ) the 'persistence' mode of the structured light model. When in persistence mode, the model stores intermediate results of the decoding, which can be inspected later by get_structured_light_object.
Note that the model might need significant memory space in this mode. Therefore, we recommend to enable this mode only during the setup and for debugging a structured light model setup.
If 'persistence' is changed, all results of the model are cleared.
Values: 'true' , 'false' , 1, 0
Default: 'false'
Parameters which influence the appearance of the generated pattern images:
Sets the width of the pattern images that are generated while calling gen_structured_light_pattern. Usually, the value should be set to the width of the monitor that is used to display the pattern images.
The value of 'pattern_width' has to be larger than the value 'min_stripe_width' /2.
If 'pattern_width' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: integer values larger or equal to 1
Default: 1024
Sets the height of the pattern images that are generated while calling gen_structured_light_pattern. Usually, the value should be set to the height of the monitor that is used to display the pattern images.
The value of 'pattern_height' has to be larger than the value 'min_stripe_width' /2.
If 'pattern_height' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: integer values larger or equal to 1
Default: 1024
Sets the width (in pixels) of the finest stripe of the pattern images that are generated while calling gen_structured_light_pattern.
The value has to be a power of two. Furthermore, it has to be smaller or equal the minimum of the parameters 'pattern_width' and 'pattern_height' after rounding both up to their next power of two.
If 'min_stripe_width' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: integer values larger or equal to 4 and a power of 2
Default: 32
Sets the normalization mode of the structured light model. If the parameter is set to 'global' , gen_structured_light_pattern generates two additional pattern images composed of a black and a white image. These images are then used in the decoding process to determine the actual pattern region. If instead, the value 'inverted_pattern' is chosen, each Gray code image is additionally inverted and the pattern region is segmented iteratively using the Gray code images and their inverted version.
If 'normalization' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: 'global' , 'inverted_pattern'
Default: 'global'
Sets the orientation of the pattern images that are generated while calling gen_structured_light_pattern. If the parameter is set to 'both' , pattern images with vertical stripes as well as pattern images with horizontal stripes are created. For 'vertical' the pattern images consist of vertical stripes only, whereas for 'horizontal' only horizontal stripes are generated.
If 'pattern_orientation' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: 'both' , 'vertical' , 'horizontal'
Default: 'both'
Sets the type of the pattern images that are generated while calling gen_structured_light_pattern. If the parameter is set to 'gray_code_and_phase_shift' not only Gray code images but also phase shift images are generated. If instead, the parameter is set to 'gray_code' only Gray code images are created.
Usually, 'gray_code_and_phase_shift' leads to more accurate results because the combination between Gray code and phase images yields sub-pixel precise monitor coordinates.
If 'pattern_type' is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_pattern has to be called before decoding the model using decode_structured_light_pattern.
Values: 'gray_code_and_phase_shift' , 'gray_code'
Default: 'gray_code_and_phase_shift'
Parameters which influence the segmentation of the pattern region:
Sets the minimum gray value difference for the Gray code images. This value is used within decode_structured_light_pattern to determine the binarized images. Thereby, for each pixel of the camera images the gray value difference between the lighted and the unlighted case is calculated. If the gray value difference of a pixel is smaller than 'min_gray_difference' , it is excluded from the domain of the binarized images (see get_structured_light_object) and thus also from further calculations.
If 'min_gray_difference' is set to the value 0, the segmented region is identical to the input region of the camera images with the only exception that pixels with a decoding result outside the pattern images are excluded.
Values: integer values larger or equal to 0
Default: 30
Parameters which influence the defect image:
Sets the sigma of the Gaussian (i.e. the amount of smoothing) that is used for the convolution of the correspondence image(s) to calculate the defect image.
Values: float or integer value larger or equal 0.01
Default: 2
This operator modifies the state of the following input parameter:
The value of this parameter may not be shared across multiple threads without external synchronization.Handle of the structured light model.
Name of the model parameter to be adjusted.
Default value: 'min_stripe_width'
List of values: 'derivative_sigma' , 'min_gray_difference' , 'min_stripe_width' , 'normalization' , 'pattern_height' , 'pattern_orientation' , 'pattern_type' , 'pattern_width' , 'persistence'
New value of the model parameter.
Default value: 32
Suggested values: 0, 0.01, 0.5, 0.7, 1, 1.4, 5, 50.0, 64, 128, 256, 1024, 'true' , 'false' , 'both' , 'vertical' , 'horizontal' , 'global' , 'inverted_pattern' , 'gray_code_and_phase_shift' , 'gray_code'
* Create the model create_structured_light_model ('deflectometry', StructuredLightModel) * Set the size of the monitor set_structured_light_model_param (StructuredLightModel, \ 'pattern_width', 1600) set_structured_light_model_param (StructuredLightModel, \ 'pattern_height', 1200) * Set the smallest width of the stripes in the pattern set_structured_light_model_param (StructuredLightModel, \ 'min_stripe_width', 8) * Generate the patterns to project gen_structured_light_pattern (PatternImages, StructuredLightModel) * Set the expected black/white contrast in the region of interest set_structured_light_model_param (StructuredLightModel, \ 'min_gray_difference', 70) * Decode the camera images decode_structured_light_pattern (CameraImages, StructuredLightModel) * Get the computed correspondences and defects get_structured_light_object (CorrespondenceImages, StructuredLightModel, \ 'correspondence_image') set_structured_light_model_param (StructuredLightModel, 'derivative_sigma', \ Sigma) get_structured_light_object (DefectImage, StructuredLightModel, \ 'defect_image') * Clean up clear_structured_light_model (StructuredLightModel)
The operator set_structured_light_model_param returns the value 2 (H_MSG_TRUE) if the given parameters are valid and within acceptable range. Otherwise, an exception will be raised.
get_structured_light_model_param
3D Metrology
Operators |