Image correction

In this third application, we will go over an example where we'll develop an autoencoder model to remove certain artificially created marks on various pictures. We will use 25 images containing a black line across the picture. The code for reading the image files and carrying out the related processing is as follows:

# Reading images and image processing
setwd("~/Desktop/peoplex")
temp = list.files(pattern="*.jpeg")
mypic <- list()
for (i in 1:length(temp)) {mypic[[i]] <- readImage(temp[i])}
for (i in 1:length(temp)) {mypic[[i]] <- resize(mypic[[i]], 128, 128)}
for (i in 1:length(temp)) {dim(mypic[[i]]) <- c(128, 128,3)}

In the preceding code, we read images with .jpeg extensions from the peoplex folder and resize these images so that they have a height and width of 128 x 128. We also update the dimensions to 128 x 128 x 3 since all the images are color images.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset