Last active
August 29, 2015 14:27
-
-
Save pepijn-devries/695d89911dd1dfa26f44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#required packages: | |
require(jpeg) | |
#Read a jpeg from a website and store as matrix "mat_clown" | |
con <- file("http://4.bp.blogspot.com/-uObQLjPG8Xg/VceaZNyI-NI/AAAAAAAAx0o/ZlcTTB1pomU/s1600/fourier_efteling.jpg", "rb") | |
#make sure 'n' is big enough to hold your entire file: | |
jpg_clown <- readBin(con, "raw", n = 3e4) | |
close(con) | |
rm(con) | |
mat_clown <- readJPEG(jpg_clown) | |
rm(jpg_clown) | |
#rotate the matrix to its intended position | |
rotate <- function(x) t(apply(x, 2, rev)) | |
mat_clown <- rotate(mat_clown) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment