opencv表面缺陷检测_检测纹理表面凸起、凹痕、划痕缺陷的检测

此示例是一个综合的示例,检测的是皮革纹理表面上出现的凸起、凹痕、划痕上的缺陷。使用的依然是光度立体法,只是不同的缺陷,需要使用的是不同参数所生成的图像。

示例代码如下:

* 使用光度立体的方法检测皮革样品* Initializationdev_update_off ()dev_close_window ()dev_open_window (0, 0, 640, 480, 'black', WindowHandle)set_display_font (WindowHandle, 14, 'mono', 'true', 'false')Message := 'Inspect leather samples using photometric stereo'disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')disp_continue_message (WindowHandle, 'black', 'true')stop ()* * Part 1* * Show input images with different illumination* 先显示并且输入同一图像在不同光照下的图像* 此缺陷检测,检测的是纹理凸起缺陷* 1. 一次性读入多个图像read_image (Images, 'photometric_stereo/leather_1_0' + [1:4])* 循环,一次选择一张图像for I := 1 to 4 by 1    Message := 'Sample 1: 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 albedoTilts := [6.1,95.0,-176.1,-86.8]Slants := [41.4,42.6,41.7,40.9]ResultType := ['gradient','albedo']* 2. 用该算子得到反照率图像和表面梯度图像photometric_stereo (Images, HeightField, Gradient, Albedo, Slants, Tilts, ResultType, 'poisson', [], [])* * Display the albedo image* 显示反照率图像dev_display (Albedo)disp_message (WindowHandle, 'The defect is clearly visible in the albedo image', 'window', 12, 12, 'black', 'true')disp_continue_message (WindowHandle, 'black', 'true')stop ()* * Detect 
  • 2
    点赞
  • 45
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值