本帖最后由 诸葛释冰 于 2024-4-30 16:17 编辑
用傅里叶变换后再用原图减去变换后的图片
read_image (Image164300o995dcsdh5x5czxx, 'E:/Halcon/Halcon学习/黑色脏污去除/164300o995dcsdh5x5czxx.bmp')
rgb3_to_gray(Image164300o995dcsdh5x5czxx, Image164300o995dcsdh5x5czxx, Image164300o995dcsdh5x5czxx, ImageGray)
get_image_size(ImageGray, Width, Height)
fft_generic(ImageGray, ImageFFT, 'to_freq', -1, 'sqrt', 'dc_center', 'complex')
gen_gauss_filter(ImageGauss, 1, 31, 0, 'none', 'dc_center',Width, Height)
convol_fft(ImageFFT, ImageGauss, ImageConvol)
fft_generic(ImageConvol, ImageFFT1, 'from_freq', 1, 'sqrt', 'dc_center', 'byte')
sub_image(ImageGray, ImageFFT1, ImageSub, 0.5 , 128)
|