read_image(Image,'D:/Halcon_Study/求背景有噪声的钢轨宽度.jpg')
get_image_size(Image,Width, Height)
rgb1_to_gray(Image,GrayImage)
rft_generic(GrayImage,ImageFFT,'to_freq','none','complex',Width)
gen_gauss_filter(ImageGauss,20,20,0,'n','rft',Width,Height)
convol_fft(ImageFFT,ImageGauss,ImageConvol)
rft_generic(ImageConvol,ImageFFT2,'from_freq','none','byte',Width)
sub_image(GrayImage,ImageFFT2,ImageSub,2,0)
threshold(ImageSub,Region,100,255)
connection(Region,ConnectedRegions)
closing_rectangle1(ConnectedRegions,RegionClosing,5,5)
opening_rectangle1(RegionClosing,RegionOpening,10,10)
select_shape(RegionOpening,SelectedRegions,'area','and',150,99999)
dev_display(Image)
dev_display(SelectedRegions)
Halcon 傅立叶求背景有噪声的钢轨宽度
最新推荐文章于 2024-08-15 06:58:22 发布