//???????????????????????GaussFilter??
//            ?????и?????????????????Sigma??
//            ?????и???????????????????????????Sigma??
//            ???????????????0.0??
//            ???????淶??’none’??
//            ???????????λ???’rft’??
//            ?????С??Width??Height??
sub_image(GaussFilter1??GaussFilter2??Filter??1??0)    //?????????????
//sub_image(ImageMinuend?? ImageSubtrahend : ImageSub : Mult?? Add : )
//g' := (g1 - g2) * Mult + Add
//????????????????????
*
*Process the images iteratively(???????е???????)
NumImages := 11
For Index := 1 to NumImages by 1        //for?????1??NumImages???????1
*
*Read an image and convert it to gray values
read_image(Image??’plastics/plastics_’+Index$’02’)
rgb1_to_gray(Image??Image)            //??????????????????????????
*Perform the convolution in the frequency domain
rft_generic(Image??ImageFFT??’to_freq’??’none’??’complex’??Width)//????????????????п????????任
//??????????????????Image??
//            ??????任???????????ImageFFT??
//            ?任????’to_freq’??’from_freq’??
//            ?任?????淶??’none’??
//            ????????????????’complex’??
//            ??????Width??
convol_fft(ImageFFT??Filter??ImageConvol)    //?????????????????????о??????
//??????????????????ImageFFT??
//            ??????????Filter??
//            ????????????
rft_generic(ImageConcol??ImageFiltered??’from_freq’??’n’??’real’??Width)    //?????????????и???????任
*
*Process the filtered image
gray_range_rect(ImageFiltered??ImageResult??10??10)//?????????????????????????Χ
//??????????????????ImageFiltered??
//            ????????Χ???ImageResult??
//            ?????????С??10??10??
min_max_rect(ImageResult??ImageResult??0??Min??Max??Range)//?ж??????????????С?
//?????????????????????ImageResult??
//            ????ImageResult??
//            ??????????????????????
//            ???????????????0??
//            ?????С????????????Χ??Min??Max??Range??
threshold(ImageResult??RegionDynThresh??max([5.55??Max*0.8])??255)//?????????????????з??
//??????????????????ImageResult??
//            ????????????RegionDynThresh??
//            ?????max([5.55??Max*0.8])??255??
//            ?????MinGray <= g <= MaxGray
connection(RegionDynThresh??ConnectedRegions)    //??????????????????
//??????????????????RegionDynThresh??
//            ????????????ConnectedRegions??
select_shape (ConnectedRegions??SelectedRegions??’area’??’and’??4??99999)//???????????????????????
//??????????????????ConnectedRegions??
//            ??????????????SelectedRegions??
//            ?????????????????’area’??
//            ???????????????????’and’??
//            ??????С?????4??
//            ????????????99999??
union1(SelectedRegions??RegionUnion)    //???????????????????
//????????????????????????????????????tedRegions??
//            ??????????????RegionUnion??
closeing_circle(RegionUnion??RegionClosing??10)//???????????????????
//??????????????????????RegionUnion??
//            ??????????RegionClosing??
//            ???????10??
connection(RegionClosing??ConnectedRegions1)
select_shape(ConnectedRegions1??SelectedRegions1??’area’??’and’??10??99999)
area_center(SelectedRegions1??Area??Row??Column)    //???????????????????λ??
//????????????????????SelectedRegions1??
//            ??????????Area??
//            ??????????У?Row??
//            ??????????У?Column??
*
*Display the results
dev_display(Image)        //?????
Number := |Area|          //?????????????Number??????????????????
if(Number)
gen_circle_contour_xld(ContCircle??Row??Column??gen_tuple_const(Number??30)??gen_tuple_const(Number??0)?? gen_tuple_const(Number??rad(360))??’positive’??1)//??????????趨????????????μ???
//???????????????磨ContCircle??
//            ????????????????Row??Cloumn??
//            ???????????gen_tuple_const(Number??30)??
//            ???????????????gen_tuple_const(Number??0)??
//            ???????????????gen_tuple_const(Number??rad(360))??
//            ?????????????
//            ?????????????1??
ResultMessage := [‘Not OK’??Number + ‘defect(s) found’]
Color := [‘red’??’black’]
dev_display(ContCircle)
else
ResultMessage := ‘OK’
Color := ‘forest green’
endif
disp_message(WindowHandle??ResultMessage??’window’??12??12??Color??’ture’)
if(Index#NumImages)
disp_continue_message(WindowHandle??’black’??’ture’)
stop()
endif
endfor
???????????????????????????У???????????????????????????磺????????????????????????????????????????????????????????????????????????????????????????????????????????????????任???????д????????????????任???????????????λ?á?
????????????????????У???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????Χ????????????????????????????????????????????????????????????????????е??????????????????????????????????и???????任???????????????????????????????????????????