Re:3D scatterplot of an image
by seanlinehan on Friday December 15, 2017 @11:59AM
(#15933152)
Do you have any examples of this? Sounds cool
[ Parent
| on HN ]
I did a Jupyter notebook http://nbviewer.jupyter.org/github/Yorwba/image_frequency_sc...
I should have probably written more comments, but I really need to go sleep now.
Re:3D scatterplot of an image
by crispyambulance on Friday December 15, 2017 @03:55PM
(#15935014)
Yep, that's it! Here's the same thing in R...
library(imager)
download.file("https://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png",'lena.png', mode = 'wb')
lena <- load.image("./lena.png")
plot(lena)
lena_fft <- FFT(lena)
lena_pwr <- sqrt( lena_fft$real^2 + lena_fft$imag^2)
lena_ph <- atan2(lena_fft$imag, lena_fft$real)
lena_ph[1:512,1:512,1,] <- matrix(runif(512*512,-pi,pi),ncol=512)
lena_mess <- FFT(lena_pwr*cos(lena_ph),lena_pwr*sin(lena_ph),inverse = TRUE)
plot(sqrt(lena_mess$real^2 + lena_mess$imag^2))