Skip to content

set_structured_light_model_paramSetStructuredLightModelParamSetStructuredLightModelParamset_structured_light_model_paramT_set_structured_light_model_param🔗

Short description🔗

set_structured_light_model_paramSetStructuredLightModelParamSetStructuredLightModelParamset_structured_light_model_paramT_set_structured_light_model_param — Set parameters of a structured light model.

Signature🔗

set_structured_light_model_param( structured_light_model StructuredLightModel, attribute.name GenParamName, attribute.value GenParamValue )void SetStructuredLightModelParam( const HTuple& StructuredLightModel, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.SetStructuredLightModelParam( HTuple structuredLightModel, HTuple genParamName, HTuple genParamValue )def set_structured_light_model_param( structured_light_model: HHandle, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> None

Herror T_set_structured_light_model_param( const Htuple StructuredLightModel, const Htuple GenParamName, const Htuple GenParamValue )

void HStructuredLightModel::SetStructuredLightModelParam( const HTuple& GenParamName, const HTuple& GenParamValue ) const

void HStructuredLightModel::SetStructuredLightModelParam( const HString& GenParamName, Hlong GenParamValue ) const

void HStructuredLightModel::SetStructuredLightModelParam( const char* GenParamName, Hlong GenParamValue ) const

void HStructuredLightModel::SetStructuredLightModelParam( const wchar_t* GenParamName, Hlong GenParamValue ) const (Windows only)

void HStructuredLightModel.SetStructuredLightModelParam( HTuple genParamName, HTuple genParamValue )

void HStructuredLightModel.SetStructuredLightModelParam( string genParamName, int genParamValue )

Description🔗

The operator set_structured_light_model_paramSetStructuredLightModelParam is used to manipulate the parameters of a structured light model StructuredLightModelstructuredLightModelstructured_light_model. The current parameter settings can be queried with the operator get_structured_light_model_paramGetStructuredLightModelParam.

For an explanation of the concept of structured light and its supported applications, see the introduction of chapter Inspection / Structured Light.

General parameters:

  • 'persistence'"persistence": Enables (GenParamValuegenParamValuegen_param_value='true'"true") or disables (GenParamValuegenParamValuegen_param_value='false'"false") the 'persistence'"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_objectGetStructuredLightObject.

    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'"persistence" is changed, all results of the model are cleared.

    List of values: 'true'"true", 'false'"false", 11, 00

    Default: 'false'"false"

Parameters which influence the appearance of the generated pattern images:

  • 'pattern_width'"pattern_width": Sets the width of the pattern images that are generated while calling gen_structured_light_patternGenStructuredLightPattern. Usually, the value should be set to the width of the monitor or projector that is used to display the pattern images.

    The value of 'pattern_width'"pattern_width" has to be larger than the value 'min_stripe_width'"min_stripe_width"/2. In case that 'pattern_type'"pattern_type" is 'single_stripe'"single_stripe", it also has to be larger than 'single_stripe_width'"single_stripe_width"/2. In case that a 'camera_setup_model'"camera_setup_model" is set in the structured light model, the value of 'pattern_width'"pattern_width" has to match the width of the projector parameters stored in the camera setup model (at Index 11).

    If 'pattern_width'"pattern_width" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    Value range: integer values larger or equal to 11

    Default: 10241024

  • 'pattern_height'"pattern_height": Sets the height of the pattern images that are generated while calling gen_structured_light_patternGenStructuredLightPattern. Usually, the value should be set to the height of the monitor or projector that is used to display the pattern images.

    The value of 'pattern_height'"pattern_height" has to be larger than the value 'min_stripe_width'"min_stripe_width"/2. In case that 'pattern_type'"pattern_type" is 'single_stripe'"single_stripe", it also has to be larger than 'single_stripe_width'"single_stripe_width"/2. In case that a 'camera_setup_model'"camera_setup_model" is set in the structured light model, the value of 'pattern_height'"pattern_height" has to match the height of the projector parameters stored in the camera setup model (at Index 11).

    If 'pattern_height'"pattern_height" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    Value range: integer values larger or equal to 11

    Default: 10241024

  • 'min_stripe_width'"min_stripe_width": Sets the width (in pixels) of the finest stripe of the pattern images that are generated while calling gen_structured_light_patternGenStructuredLightPattern.

    The value has to be a power of two. Furthermore, it has to be smaller or equal the minimum of the parameters 'pattern_width'"pattern_width" and 'pattern_height'"pattern_height" after rounding both up to their next power of two. In case that 'pattern_type'"pattern_type" is 'single_stripe'"single_stripe", it also has to be smaller or equal the 'single_stripe_width'"single_stripe_width".

    If 'min_stripe_width'"min_stripe_width" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    Value range: integer values larger or equal to 44 and a power of 2

    Default: 3232

  • 'normalization'"normalization": Sets the normalization mode of the structured light model. If the parameter is set to 'global'"global", gen_structured_light_patternGenStructuredLightPattern 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'"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'"normalization" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    List of values: 'global'"global", 'inverted_pattern'"inverted_pattern"

    Default: 'global'"global"

  • 'pattern_orientation'"pattern_orientation": Sets the orientation of the pattern images that are generated while calling gen_structured_light_patternGenStructuredLightPattern. If the parameter is set to 'both'"both", pattern images with vertical stripes as well as pattern images with horizontal stripes are created. For 'vertical'"vertical" the pattern images consist of vertical stripes only, whereas for 'horizontal'"horizontal" only horizontal stripes are generated.

    If 'pattern_orientation'"pattern_orientation" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    List of values: 'both'"both", 'vertical'"vertical", 'horizontal'"horizontal"

    Default: 'both'"both"

  • 'pattern_type'"pattern_type": Sets the type of the pattern images that are generated while calling gen_structured_light_patternGenStructuredLightPattern.

    ‘pattern_type’ Generated Images
    'gray_code'"gray_code" Gray code images
    'gray_code_and_phase_shift'"gray_code_and_phase_shift" Gray code images and phase shift images
    'single_stripe'"single_stripe" Single stripe images, Gray code images and phase shift images

    Usually, 'gray_code_and_phase_shift'"gray_code_and_phase_shift" leads to more accurate results than 'gray_code'"gray_code" because the combination between Gray code and phase images yields sub-pixel precise monitor or projector coordinates. 'single_stripe'"single_stripe" can increase robustness in case of only partially specular surfaces.

    If 'pattern_type'"pattern_type" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    List of values: 'gray_code_and_phase_shift'"gray_code_and_phase_shift", 'gray_code'"gray_code", 'single_stripe'"single_stripe"

    Default: 'gray_code_and_phase_shift'"gray_code_and_phase_shift"

  • 'single_stripe_width'"single_stripe_width": Sets the width (in pixels) of the single stripe that is generated while calling gen_structured_light_patternGenStructuredLightPattern using the 'pattern_type'"pattern_type" 'single_stripe'"single_stripe".

    The value has to be a power of two and has to be greater or equal 'min_stripe_width'"min_stripe_width". Furthermore, it has to be smaller or equal the minimum of the parameters 'pattern_width'"pattern_width" and 'pattern_height'"pattern_height" after rounding both up to their next power of two.

    Note that 'single_stripe_width'"single_stripe_width" can only be set in case that 'pattern_type'"pattern_type" is 'single_stripe'"single_stripe". When 'pattern_type'"pattern_type" is changed to 'single_stripe'"single_stripe", 'single_stripe_width'"single_stripe_width" is set to some power of two roughly halfway between the currently set 'min_stripe_width'"min_stripe_width" and the minimum of 'pattern_width'"pattern_width" and 'pattern_height'"pattern_height".

    If 'single_stripe_width'"single_stripe_width" is changed, the model is not decodable anymore and all possibly available results are cleared. Therefore, gen_structured_light_patternGenStructuredLightPattern has to be called before decoding the model using decode_structured_light_patternDecodeStructuredLightPattern.

    Value range: integer values larger or equal to 44 and a power of 2

    Default: power of two roughly halfway between the currently set 'min_stripe_width'"min_stripe_width" and 'pattern_width'"pattern_width", 'pattern_height'"pattern_height"

Parameters which influence the segmentation of the pattern region:

  • 'min_gray_difference'"min_gray_difference": Sets the minimum gray value difference for the Gray code images. This value is used within decode_structured_light_patternDecodeStructuredLightPattern 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'"min_gray_difference", it is excluded from the domain of the binarized images (see get_structured_light_objectGetStructuredLightObject) and thus also from further calculations.

    If 'min_gray_difference'"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.

    Value range: integer values larger or equal to 00

    Default: 3030

Parameters for structured light models of type ‘deflectometry’:

  • 'derivative_sigma'"derivative_sigma": 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.

    Value range: float or integer value larger or equal 0.010.01

    Default: 22

Parameters for structured light models of type ‘3d_reconstruction’:

Execution information🔗

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🔗

StructuredLightModelstructuredLightModelstructured_light_model (input_control, state is modified) structured_light_model → (handle)HTuple (HHandle)HStructuredLightModel, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the structured light model.

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Name of the model parameter to be adjusted.

Default: 'min_stripe_width'"min_stripe_width"
List of values: 'camera_setup_model', 'derivative_sigma', 'min_gray_difference', 'min_stripe_width', 'normalization', 'pattern_height', 'pattern_orientation', 'pattern_type', 'pattern_width', 'persistence', 'single_stripe_width'"camera_setup_model", "derivative_sigma", "min_gray_difference", "min_stripe_width", "normalization", "pattern_height", "pattern_orientation", "pattern_type", "pattern_width", "persistence", "single_stripe_width"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)MaybeSequence[Union[int, float, str]]Htuple (Hlong / double / char*)

New value of the model parameter.

Default: 3232
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', 'single_stripe'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", "single_stripe"

Example🔗

(HDevelop)

* 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')

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

create_structured_light_modelCreateStructuredLightModel

See also

get_structured_light_model_paramGetStructuredLightModelParam

Module🔗

3D Metrology