zoukankan      html  css  js  c++  java
  • 二维图像的傅里叶变换

    背景

    Matlab Example

    img=rgb2gray(imread("image1.jpg"));
    freq=fftshift(fft2(im2double(img)));
    fout=log(abs(freq)+1.001);
    subplot(2,1,1),imshow(img);
    subplot(2,1,2),imshow(fout,[]);
    

    Play More

    f=zeros(32);
    f(14,16)=1;
    f(18,16)=1;
    img=fftshift(fft2(f));
    iout=abs(img);
    subplot(2,2,1),imshow(f);
    subplot(2,2,2),imshow(iout,[]);
    
    f=zeros(32);
    f(14,14)=1;
    f(18,18)=1;
    img=fftshift(fft2(f));
    iout=abs(img);
    subplot(2,2,3),imshow(f);
    subplot(2,2,4),imshow(iout,[]);
    

    Naive 的滤波示例

    img=imresize(rgb2gray(imread("image1.jpg")),0.2);
    freq=fftshift(fft2(im2double(img)));
    fout=log(abs(freq)+1.001);
    subplot(2,2,1),imshow(img);
    subplot(2,2,2),imshow(fout,[]);
    
    [h,w]=size(freq);
    cx=w/2;
    cy=h/2;
    for y=1:h
        for x=1:w
            dx=abs(x-cx);
            dy=abs(y-cy);
            if dx>=10 || dy>=10
                freq(y,x)=0;
            end
        end
    end
    
    fout2=log(abs(freq)+1.001);
    subplot(2,2,3),imshow(fout2,[]);
    
    img2=mat2gray(abs(ifft2(ifftshift(freq))));
    subplot(2,2,4),imshow(img2,[]);
    

  • 相关阅读:
    谜之This
    JS 面向对象 ~ 继承的7种方式
    JS 面向对象 ~ 创建对象的 9 种方式
    JS 原型与原型链
    ES6 Promise 详解
    Vue diff 算法
    Vue Router 路由实现原理
    Vue Keep-alive 原理
    Vue 响应式原理
    JS 有趣的JS
  • 原文地址:https://www.cnblogs.com/mollnn/p/14949678.html
Copyright © 2011-2022 走看看