SOCR ≫ TCIU Website ≫ TCIU GitHub ≫

1 2D FT and Image Synthesis

Let’s try to perform the same image synthesis to reconstruct the Cyrillic and English alphabet images.

## [1] 411 353
## [1] 411 353

############## FT of img_CyrAlpha  
#X1 = fft(img_CyrAlpha); display(fftshift(Re(X1)), method = "raster")
#X1_mag <- sqrt(Re(X1)^2+Im(X1)^2); display(fftshift(X1_mag), method = "raster") # magnitude only
#X1_phase  <- atan2(Im(X1), Re(X1)); display(fftshift(X1_phase), method = "raster") # phase only
#####  Implicit Automated IFT
#hat_X1 = Re(fft(X1, inverse = T)/length(square_arr)); display(hat_X1, method = "raster")  
###### Manually invert the FT (IFT) using the magnitudes and phases
#Real1 = X1_mag * cos(X1_phase)
#Imaginary1 = X1_mag * sin(X1_phase)
#man_hat_X1 = Re(fft(Real1+1i*Imaginary1, inverse = T)/length(X1)); display(man_hat_X1, method = "raster")  

############### FT of img_EngAlpha
#X2 = fft(circle_arr); display(Re(X2), method = "raster")
#X2_mag <- sqrt(Re(X2)^2+Im(X2)^2); display(X2_mag, method = "raster") # magnitude only
#X2_phase  <- atan2(Im(X2), Re(X2)); display(X2_phase, method = "raster") # phase only
######  Implicit Automated IFT
# hat_X2 = Re(fft(X2, inverse = T)/length(circle_arr)); display(hat_X2, method = "raster") 
###### Manually invert the FT (IFT) using the magnitudes and phases
#Real2 = X2_mag * cos(X2_phase)
#Imaginary2 = X2_mag * sin(X2_phase)
#man_hat_X2 = Re(fft(Real2+1i*Imaginary2, inverse = T)/length(X1)); display(man_hat_X2, method = "raster")  

# IFT Magnitude=mag_ft_img_CyrAlpha   AND  Phase=phase_ft_img_EngAlpha
Real = mag_ft_img_CyrAlpha * cos(phase_ft_img_EngAlpha)
Imaginary = mag_ft_img_CyrAlpha * sin(phase_ft_img_EngAlpha)
ift_MagCyr_PhaseEng = Re(fft(Real+1i*Imaginary, inverse = T)/length(mag_ft_img_CyrAlpha))
EBImage::display(ift_MagCyr_PhaseEng, method = "raster", title="(IFT o FT) Magnitude=Cyr | Phase=Eng")