library(OpenImageR)
#-------
# matrix
#-------
set.seed(1)
mt = matrix(runif(100), 10, 10)
res_mt = padding(mt, 15, 20, fill_value = -1)
#------
# array
#------
lst = list(matrix(1, 10, 10), matrix(2, 10, 10))
arr = List_2_Array(lst, verbose = FALSE)
res_arr = padding(arr, 15, 20, fill_value = mean(as.vector(mt)))
Run the code above in your browser using DataLab