Advertisement
phy_bunny

Fourier_Transform_video

Sep 4th, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.93 KB | None | 0 0
  1. clear
  2. % %%%%%读取图像(视频)                          %导入视频
  3. video = VideoReader("视频素材")
  4. img = read(video,1);
  5. %%%%%分开RGB通道进行傅里叶变换
  6. for i = 1:3
  7.     colour = img(:,:,i);                       %提取颜色数据
  8.     fcolour = fft2(colour);                    %傅里叶变换
  9.     fcolour_centre = fftshift(fcolour);        %频谱移到中心
  10.     T=angle(fcolour_centre)*180/pi;             %对相位谱进行增强
  11.     fcolour_centre(abs(fcolour_centre)<2000)=0; %减少细节
  12.     out_colour = ifft2(fcolour);               %傅里叶逆变换
  13.     out(:,:,i) = real(out_colour);      
  14.     subplot(3,3,i);imshow(log(fcolour_centre)+eps,[]);colormap("gray");  %频谱展示
  15.     subplot(3,3,i+3);imshow(T);colormap("gray");                         %相位图展示
  16.     colour = zeros;
  17. end
  18.  
  19. out = uint8(out);   %恢复图像
  20. %%%%%画图
  21. subplot(3,3,7);imshow(img);
  22. subplot(3,3,8);imshow(out);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement