Resizing image in R

前端 未结 5 2501
天命终不由人
天命终不由人 2020-12-25 14:56

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

5条回答
  •  不思量自难忘°
    2020-12-25 15:03

    The package imager is a nice fit and hides all the details about splines, interpolations and simply stores the images in a 4 dimensional array (the fourth dimension being used in the case of videos)

    library(imager)
    
    im <- load.image(my_file)
    
    thmb <- resize(im,round(width(im)/10),round(height(im)/10))
    
    plot(im)
    plot(thmb,main="Thumbnail")
    

    More informations can be found here: on the official introduction.

提交回复
热议问题