Unity playback brick play game (simple)

2022-12-28   ES  

The point is to understand “changes in the form of frequency domain expression caused by image distortion or rotation”.

% SAR_Figure_2_2
% 2016.10.31
clear all;clc;close all;

%% parameter settings
M = 256;                % matrix height
N = 256;                % matrix width
top = M/8+1;
bottom = M*7/8;
left = N/8+1;
right = N*7/8;
theta = pi/12;          % twist or rotation angle

%% generation signal
% original signal
S0 = zeros(M,N);
S0(top:bottom,left:right) = 1;
% distorted signal
S1 = zeros(M,N);
for ii = 1:M
    for jj = 1:N
        x = jj-N/2;
        y = (M+1-ii)-M/2;
        xx = round(x+N/2);
        yy = M+1-round(x*sin(-theta)+y*cos(-theta)+M/2);
        if(yy>=1 && yy<= M)
            S1(ii,jj) = S0(yy,xx);
        end
    end
end
% rotation signal
S2 = zeros(M,N);
for ii = 1:M
    for jj = 1:N
        x = jj-N/2;
        y = (M+1-ii)-M/2;
        xx = round(x*cos(-theta)-y*sin(-theta)+N/2);
        yy = M+1-round(x*sin(-theta)+y*cos(-theta)+M/2);
        if(xx>=1 && xx<= N && yy>=1 && yy<=M)
            S2(ii,jj) = S0(yy,xx);
        end
    end
end
%% Two -dimensional Fourier transformation
% of the two -dimensional Fourier transformation of the original signal
S0_ff = fftshift(fft2(fftshift(S0)));
S0_ff = abs(S0_ff);
S0_ff = S0_ff/max(max(S0_ff));
S0_ff = 20*log10(S0_ff+1e-4);
% original signal two -dimensional Fourier transformation
S1_ff = fftshift(fft2(fftshift(S1)));
S1_ff = abs(S1_ff);
S1_ff = S1_ff/max(max(S1_ff));
S1_ff = 20*log10(S1_ff+1e-4);
% original signal two -dimensional Fourier transformation
S2_ff = fftshift(fft2(fftshift(S2)));
S2_ff = abs(S2_ff);
S2_ff = S2_ff/max(max(S2_ff));
S2_ff = 20*log10(S2_ff+1e-4);

%% drawing
figure,set(gcf,'Color','w');colormap jet
subplot(2,3,1),imagesc(S0);axis image off
title('(a) time domain, original signal');
subplot(2,3,4),imagesc(S0_ff);axis image off
title('(b) Original signal spectrum');
subplot(2,3,2),imagesc(S1);axis image off
title('(C) time domain, distorted signal');
subplot(2,3,5),imagesc(S1_ff);axis image off
title('(d) Turn signal spectrum');
subplot(2,3,3),imagesc(S2);axis image off
title('(e) time domain, rotating signal');
subplot(2,3,6),imagesc(S2_ff);axis image off
title('(F) Rotating signal spectrum');

source

Related Posts

Seeking the shortest path of the picture 2 Detailed explanation of the Dijkstra algorithm Eric

docker set up registry (built with the new version of Docker-CE)

c# to determine whether the two pictures are consistent with two methods, Summerdream

Solution Python Install Package Slow

Unity playback brick play game (simple)

Random Posts

10.31 NOIP simulation race (Morning)

Hangdian ACM2089 Do not 62JOHN

minimum generation tree -template scar

[A must -have for the interview] In 2021, you are just a notes with bytes. The content is too real.

Use myBatis-Generator to automatically generate code