Filter Learning Notes Bigdevil

2023-01-25   ES  

On the principle of two -dimensional DFT, you can refer to the “Image Engineering Volume” published by Tsinghua, so the principle of two -dimensional DFT is repeated here. If you don’t understand, the effect image will not understand why.
So I call the library FFT2 (x) directly in the code;

% by keyhero
% img_fft.m
clear;
lena=imread('lena.bmp');
freq=fft2(lena);
freq = fftshift(freq);
ampt=abs(freq);
temp=max(ampt);
max_val=max(temp);
temp=min(ampt);
min_val=min(temp);
slope=255/(max_val - min_val);
for i=1:256
    for j=1:256
        temp(i,j)=uint8(slope*(ampt(i,j) - min_val));
        if temp(i,j)~=0
            temp(i,j)=256;
        end
    end
end
imgfft=uint8(temp);
subplot(121);imshow(lena);
subplot(122);imshow(imgfft);

直接显示结果freq数组
You will find that this is a messy image. It looks like a mess. The normal situation should be at the middle part of the high frequency and the low frequency is around. In fact, the image array is distributed like this, but it can only be displayed on the computer. The gray value to 255.
So, gray should be mapped, and mapping from MAX to 255

MATLAB displayed the value distribution as follows:
数值分布

So there is a FOR loop in the above code, and in order to highlight the display effect, the pixel value is dual -value

The results after

are as follows:
result

It can be found that when the image display pixel value is normalized, it is relatively obvious in the middle part of the image (that is, the low -frequency part of the Fourier transformation), and the symmetry of the Fourier transformation of Fourier in the vertical and horizontal direction is more obvious, and Essence The reason why there are more low -frequency parts is determined by the pixel distribution of this image.

Thank you!

source

Related Posts

【吴恩达】机器学习ex3编程练习

Writing a program, receive a lowercase letter from the keyboard, and then find out its front guide characters and subsequent characters, and then display these three characters in order

Vue Sort the array obtained

stm32 clock module STM32F103RCT6 The clock module of the STM32 compared with 51 has become more complicated than STM’s powerful functions. The clock frequency that needs to be used in different modules is different. And higher frequencies will cause more energy waste. The following is my summary in the STM32 process.

Filter Learning Notes Bigdevil

Random Posts

Three -dimensional human gesture Estimated annual progress review (Professor Zhou Xiaowei) Highlight

[Unity3D official mobile game optimization guide] 7. Resources

UNITY implementation model cutting -EZysLice plug -in

SpringBoot the order of the default access path of static files such as HTML and other static files

AUBO Robot AUBO-I5 code execution process