-
Book Overview & Buying
-
Table Of Contents
Applied Unsupervised Learning with R
By :
Solution:
Download the Borges photo to your computer and save it as borges.jpg. Make sure that it is saved in R's working directory. If it is not in R's working directory, then change R's working directory using the setwd() function. Then, you can load this image into a variable called im (short for image), as follows:
install.packages('imager')
library('imager')
filepath<-'borges.jpg'
im <- imager::load.image(file =filepath) The rest of the code we will explore will use this image, called im. Here, we have loaded a picture of the Alamo into im. However, you can run the rest of the code on any image, simply by saving the image to your working directory and specifying its path in the filepath variable.
The signature we are developing is meant to be used for grayscale images. So, we will convert this image to grayscale, using functions in the imager package:
im<-imager::rm.alpha(im) im...
Change the font size
Change margin width
Change background colour