设置首页收藏本站
开启左侧

FFT的详细解释

  [复制链接]
dianke09 发表于 2021-8-17 15:04:11 | 显示全部楼层
知识不够,还看不太懂
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
A君临天下 发表于 2021-10-12 10:42:09 | 显示全部楼层
看不Fong懂
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
031415850204 发表于 2021-11-3 10:44:48 | 显示全部楼层
看起来不错的说
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
110110 发表于 2021-11-16 15:00:26 | 显示全部楼层
学习一下
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
Ayumi2022 发表于 2022-1-22 20:46:12 | 显示全部楼层
akhdkahflah
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
舅舅的舅舅 发表于 2022-2-23 15:49:14 | 显示全部楼层
学习一下
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
zshy2020 发表于 2022-4-16 20:17:18 | 显示全部楼层
复习复习fft!
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
大力小丸子 发表于 2022-7-8 09:15:20 | 显示全部楼层


在配合halcon的例子+图片就好点了,有理论配合实际应用。
使用FFT去除纹理的例子:
先看图片效果:


dev_update_off ()
dev_close_window ()
Scale := [1.0,.65]
MinGray := [50,100]
Images:=[]
Images[0]:='C:/Users/leady28/Desktop/处理前后效果图/01.bmp'
Images[1]:='C:/Users/leady28/Desktop/处理前后效果图/02.bmp'
for Index := 0 to |Images|-1 by 1
    *
    * Read and display the image
    read_image (Image, Images[Index])
    get_image_size (Image, Width, Height)
    dev_open_window (0, 0, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle)
    set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
    dev_set_part (0, 0, Height - 1, Width - 1)
    dev_display (Image)
    disp_message (WindowHandle, 'Original image', 'image', 12, 12, 'black', 'true')
    *
    * Perform fft and display spectrum
    optimize_fft_speed (Width, Height, 'standard')
    *
    * We used 'fft_generic' 'sqrt' and 'dc_center' mainly
    * for visualization purposes.
    * To speed up the program, rft_generic should be used;
    * but of course, the peak detection algorithm has to be
    * adjusted in this case.
    fft_generic (Image, ImageFFT, 'to_freq', -1, 'sqrt', 'dc_center', 'complex')
    dev_open_window (0, Width * Scale[Index] + 7, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle1)
    dev_set_color ('red')
    dev_set_draw ('margin')
    set_display_font (WindowHandle1, 14, 'mono', 'true', 'false')
    dev_set_part (0, 0, Height - 1, Width - 1)
    dev_display (ImageFFT)
    disp_message (WindowHandle1, 'Fourier spectrum', 'image', 12, 12, 'black', 'true')
    disp_cont_message (WindowHandle1, 'black', 'true')
    stop ()
    *
    * Detect the eight most significant peaks in the spectrum
    power_real (ImageFFT, PowerSpectrum)
    binomial_filter (PowerSpectrum, ImageSmooth, 9, 9)
    threshold (ImageSmooth, Region, MinGray[Index], 100000)
    connection (Region, ConnectedRegions)
    select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 5, 200)
    union1 (SelectedRegions, RegionUnion)
    reduce_domain (ImageSmooth, RegionUnion, ImageReduced)
    local_max (ImageReduced, LocalMaxima)
    *
    * Next, detect peaks one octave higher, i.e., at twice
    * the frequency of the most significant peaks
    shape_trans (LocalMaxima, RegionTrans, 'convex')
    * Construct ROI band at twice the frequency
    hom_mat2d_identity (HomMat2DIdentity)
    hom_mat2d_scale (HomMat2DIdentity, 2.1, 2.1, Height / 2, Width / 2, HomMat2DScale)
    affine_trans_region (RegionTrans, RegionTrans1, HomMat2DScale, 'nearest_neighbor')
    hom_mat2d_scale (HomMat2DIdentity, 1.9, 1.9, Height / 2, Width / 2, HomMat2DScale)
    affine_trans_region (RegionTrans, RegionTrans2, HomMat2DScale, 'nearest_neighbor')
    difference (RegionTrans1, RegionTrans2, RegionDifference)
    * Extract the peaks at twice the frequency
    reduce_domain (ImageSmooth, RegionDifference, ImageReduced)
    threshold (ImageReduced, Region, 15, 100000)
    reduce_domain (ImageSmooth, Region, ImageReduced)
    local_max (ImageReduced, LocalMaxima2)
    *
    * Merge the peaks of both octaves and enlarge them to
    * integrate the relevant frequencies into the filter
    union2 (LocalMaxima, LocalMaxima2, RegionUnion)
    dilation_circle (RegionUnion, RegionDilation, 15.5)
    paint_region (RegionDilation, ImageFFT, ImageFFTFiltered, 0, 'fill')
    dev_display (ImageFFT)
    dev_display (RegionDilation)
    disp_message (WindowHandle1, 'Frequencies of the\nbackground texture', 'image', 12, 12, 'black', 'true')
    disp_cont_message (WindowHandle1, 'black', 'true')
    stop ()
    *
    * Apply the filter and display the results
    fft_generic (ImageFFTFiltered, ImageFiltered, 'from_freq', 1, 'sqrt', 'dc_center', 'byte')
    dev_display (ImageFiltered)
    disp_message (WindowHandle1, 'Filtered image', 'image', 12, 12, 'black', 'true')
    *
    dev_open_window (0, 2 * (Width * Scale[Index]) + 14, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle2)
    set_display_font (WindowHandle2, 14, 'mono', 'true', 'false')
    dev_set_part (0, 0, Height - 1, Width - 1)
    sub_image (Image, ImageFiltered, ImageTexture, 1, 128)
    dev_display (ImageTexture)
    disp_message (WindowHandle2, 'Removed texture', 'window', 12, 12, 'black', 'true')
    if (Index < 1)
        disp_cont_message (WindowHandle2, 'black', 'true')
        stop ()
        dev_close_window ()
        dev_close_window ()
        dev_close_window ()
    endif
endfor

处理后-1

处理后-1

处理后-2

处理后-2

处理前-1

处理前-1

处理前-2

处理前-2
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
geng5521 发表于 2022-8-12 21:39:34 | 显示全部楼层
很想学,但是一直没搞懂
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表