Handling image data

In this section, we will read image data into R and explore it further to understand the various characteristics of image data. The code for reading and displaying images is as follows:

# Librarieslibrary(keras)library(EBImage)# Reading and plotting imagessetwd("~/Desktop/image18")temp = list.files(pattern="*.jpg")mypic <- list()for (i in 1:length(temp)) {mypic[[i]] <- readImage(temp[i])}par(mfrow = c(3,6))for (i in 1:length(temp)) plot(mypic[[i]])par(mfrow = c(1,1))

As you can see from the preceding code, we will make use of the keras and EBImage libraries. The EBImage library is useful for handling and exploring image data. We will start by reading 18 JPEG image files that are stored in the image18 folder of my computer. ...

Get Advanced Deep Learning with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.