I am trying to work with some image data in R, and cannot figure out how to resize the images I have to ensure they are all the same size.
In Python, I approached th
Inspired by Seily, to resize grey level image.
resize = function(img, new_width, new_height) {
new_img = apply(img, 2, function(y){return (spline(y, n = new_height)$y)})
new_img = t(apply(new_img, 1, function(y){return (spline(y, n = new_width)$y)}))
new_img[new_img < 0] = 0
new_img = round(new_img)
return (new_img)
}