行業(yè)新聞
AOI中通用的圖像檢測(cè)方法檢測(cè)方法
AOI中通用的圖像檢測(cè)方法方法有3個(gè):
(1)將RGB圖轉(zhuǎn)換為灰度圖再進(jìn)行比對(duì)
(2)將母版圖上的金面作為ROI
(3)使用腐蝕算子來(lái)消除邊緣干擾
****************************************************************
*使用與母版相減的方式
***************************************************************
(1)將RGB圖轉(zhuǎn)換為灰度圖再進(jìn)行比對(duì)
***************************************************************
rgb1_to_gray (BrightLeftWireBondingImageReduced, GrayRec)
rgb1_to_gray(DarkLeftWireBondingImageReduced,GrayStandard)
****************************************************************
(2)根據(jù)母版圖像的金面設(shè)定檢測(cè)區(qū)域
****************************************************************
threshold (GrayStandardImageReduced, StandardRegion, 200, 255)
****************************************************************
(3)使用腐蝕算子來(lái)消除邊緣干擾
****************************************************************
erosion_circle (StandardRegion, StandardRegion, 2)
*縮小檢測(cè)范圍
reduce_domain (GrayRec, StandardRegion, GrayRecImageReduced)
reduce_domain (GrayStandard, StandardRegion, GrayStandardImageReduced)
abs_diff_image (GrayRecImageReduced,GrayStandardImageReduced,ImageAbsDiff, 1)
threshold (ImageAbsDiff, Region, 80, 255)
connection (Region, ConnectedRegions)
*誤差主要是水平線,因此通過(guò)高度大于3個(gè)像素、面積大于9個(gè)像素來(lái)判斷
select_shape (ConnectedRegions, ConnectedRegions, ['area','height'], 'and', [9,3], [99999,99999])
count_obj (ConnectedRegions, Number)
if(Number > 0)
CurrentNgLight := 0
CurrentNgCode := 0
union1 (ConnectedRegions, RegionUnion)
smallest_rectangle1 (RegionUnion, Row1, Column1, Row2, Column2)
CurrentNgPos := [Row1-10, Column1-10, Row2+10, Column2+10]
CurrentNgDescribe := 'LWBConnectedRegions有變色'
MFOL2_Gather_Ng (CurrentNgCode, CurrentNgPos, CurrentNgDescribe, 0, 0)
endif
return ()