haclcon_钢坯表面检测

在这里插入图片描述

  • This program demonstrates the use of the photometric stereo technique
  • for the inspection of the flooring panels.
  • Input are 4 images taken from flooring panels
  • with light coming from different orientations.
  • Initialization
    dev_close_window ()
    dev_update_off ()
    dev_open_window (0, 0, 640, 512, ‘black’, WindowHandle)
    set_display_font (WindowHandle, 14, ‘mono’, ‘true’, ‘false’)
    Message := ‘Inspect the label of flooring panels’
    Message[1] := ‘using photometric stereo. In this case four’
    Message[2] := ‘different light orientations were used.’
    disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)
    disp_continue_message (WindowHandle, ‘black’, ‘true’)
    stop ()
    for Index := 1 to 2 by 1
    *
    • Show input images with different illumination
      read_image (Images, ‘photometric_stereo/flooring_’ + Index + ‘_0’ + [1:4])
      for I := 1 to 4 by 1
      Message := ‘Acquire image ’ + I + ’ of 4’
      select_obj (Images, ObjectSelected, I)
      dev_display (ObjectSelected)
      disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)
      wait_seconds (0.5)
      endfor
    • Apply photometric stereo to determine the albedo
    • and the surface gradient.
      Slants := [39.4,40.5,39.5,38.4]
      Tilts := [-6.0,83.7,172.9,-98.2]
      ResultType := [‘gradient’,‘albedo’]
      photometric_stereo (Images, HeightField, Gradient, Albedo, Slants, Tilts, ResultType, ‘poisson’, [], [])
    • Display the albedo image
      dev_display (Albedo)
      disp_message (WindowHandle, ‘Albedo image’, ‘window’, 12, 12, ‘black’, ‘true’)
      disp_continue_message (WindowHandle, ‘black’, ‘true’)
      stop ()
    • Calculate the gaussian curvature of the surface
    • using the gradient field as input for the operator
    • derivate_vector_field.
    • Defects are usually easy to detect in the curvature image.
      derivate_vector_field (Gradient, MeanCurvature, 1.0, ‘mean_curvature’)
    • Detect defects
    • Segment the tablet areas in the curvature image
      threshold (MeanCurvature, Region, 0.02, 1000)
      connection (Region, Defects)
      area_center (Defects, Area, Row, Column)
      gen_circle (Circle, Row, Column, sqrt(Area) + 10)
    • Display the defects in curvature image
      dev_set_draw (‘margin’)
      dev_set_color (‘red’)
      dev_set_line_width (2)
      dev_display (MeanCurvature)
      dev_display (Circle)
      Message := ‘The defects can easily be detected’
      Message[1] := ‘in the surface curvature image’
      disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)
      stop ()
    • Display the defects in the albedo image
      dev_set_draw (‘margin’)
      dev_set_color (‘red’)
      dev_display (Albedo)
      dev_display (Circle)
      disp_message (WindowHandle, ‘Defects in albedo image’, ‘window’, 12, 12, ‘black’, ‘true’)
      if (Index < 2)
      disp_continue_message (WindowHandle, ‘black’, ‘true’)
      stop ()
      endif
      endfor
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值