本帖最后由 gongxiaolei90 于 2020-7-27 11:26 编辑
今天看了structured_light_tap_collar.hdev示例,但是没有明白它的图片路径在哪里设置的?
- * This example shows the main workflow necessary when using the method
- * of deflectometry for defect detection on specular surfaces.
- *
- * It can be used as a template for your own application, in which case
- * certain parameters need to be adapted to the particular setup.
- *
- dev_update_off ()
- dev_close_window ()
- dev_open_window (0, 0, 600, 450, 'black', WindowHandle)
- set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
- *
- dev_displ_workflow_text ()
- stop ()
- * First a structured light model of type 'deflectometry'
- * needs to be created and the parameters necessary for the
- * generation of the pattern images need to be set.
- create_structured_light_model ('deflectometry', StructuredLightModel)
- *
- * --- Adapt the following parameters to your application ---
- * Height and width of the pattern images that are to be
- * displayed on the monitor.
- PatternWidth := 1600
- PatternHeight := 1200
- * Pattern type that is to be used. In this case, phase shift
- * images in addition to gray code images are displayed.
- PatternType := 'gray_code_and_phase_shift'
- * Orientation of the pattern images. In this case,
- * we display patterns with stripes in both the vertical and
- * the horizontal direction.
- PatternOrientation := 'both'
- * Minimum width of the stripes appearing in the
- * gray code images. The parameter is chosen such that the
- * smallest stripes are still clearly visible in the camera
- * images.
- MinStripeWidth := 8
- * Type of normalization to be used in order to decode
- * the gray code images. In this case we use the type 'global'
- * in which a completely white image and a completely black
- * image are additionally displayed.
- Normalization := 'global'
- * Set the above parameters in the structured light model.
- set_structured_light_model_param (StructuredLightModel, ['pattern_width','pattern_height','pattern_type','pattern_orientation','min_stripe_width','normalization'], [PatternWidth,PatternHeight,PatternType,PatternOrientation,MinStripeWidth,Normalization])
- *
- dev_disp_parameters_text ()
- stop ()
- *
- * Generate the pattern images to be displayed on the monitor.
- gen_structured_light_pattern (PatternImages, StructuredLightModel)
- *
- dev_disp_acquisition_text ()
- stop ()
- * Display the images on the monitor and acquire the
- * the corresponding camera images.
- acquire_camera_images_deflectometry (PatternImages, CameraImages, PatternWidth, PatternHeight)
- *
- * The camera images can now be decoded.
- * Set the parameter 'min_gray_difference' to a suitable value.
- MinGrayDifference := 130
- set_structured_light_model_param (StructuredLightModel, 'min_gray_difference', MinGrayDifference)
- dev_disp_decoding_text ()
- stop ()
- decode_structured_light_pattern (CameraImages, StructuredLightModel)
- * Get the computed correspondences images.
- get_structured_light_object (CorrespondenceImages, StructuredLightModel, 'correspondence_image')
- dev_clear_window ()
- select_obj (CorrespondenceImages, CorrespondenceColumn, 1)
- dev_display (CorrespondenceColumn)
- dev_disp_text (['Correspondence image (1/2): Column values of the corresponding',' monitor pixels'], 'window', 'top', 'left', 'black', [], [])
- dev_disp_text ('Press Run (F5) to continue', 'window', 'bottom', 'right', 'black', [], [])
- stop ()
- dev_clear_window ()
- select_obj (CorrespondenceImages, CorrespondenceRow, 2)
- dev_display (CorrespondenceRow)
- dev_disp_text (['Correspondence image (2/2): Row values of the corresponding',' monitor pixels'], 'window', 'top', 'left', 'black', [], [])
- dev_disp_text ('Press Run (F5) to continue', 'window', 'bottom', 'right', 'black', [], [])
- stop ()
- *
- * Defect image
- dev_disp_defects_text ()
- stop ()
- * Get the defect image.
- Sigma := 1
- set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
- set_structured_light_model_param (StructuredLightModel, 'derivative_sigma', Sigma)
- get_structured_light_object (DefectImage1, StructuredLightModel, 'defect_image')
- scale_image_range (DefectImage1, ScaledDefectImage1, 0, 4)
- dev_clear_window ()
- dev_display (ScaledDefectImage1)
- dev_disp_text ('Defect image with \'derivative_sigma\' set to ' + Sigma + ':', 'window', 'top', 'left', 'black', [], [])
- *
- * Get a defect image with a different value of 'derivative_sigma'.
- Sigma := 5
- dev_open_window (0, 609, 600, 450, 'black', WindowHandle2)
- set_display_font (WindowHandle2, 14, 'mono', 'true', 'false')
- dev_set_window (WindowHandle2)
- set_structured_light_model_param (StructuredLightModel, 'derivative_sigma', Sigma)
- get_structured_light_object (DefectImage5, StructuredLightModel, 'defect_image')
- scale_image_range (DefectImage5, ScaledDefectImage5, 0, 1)
- dev_display (ScaledDefectImage5)
- dev_disp_text ('Defect image with \'derivative_sigma\' set to ' + Sigma + ':', 'window', 'top', 'left', 'black', [], [])
复制代码 |