R raster rotating images and not changing their size

不羁岁月 提交于 2019-12-25 14:12:05

问题


I have below code which rotates an image. But the rotated image has different dimensions. How could we ensure that the rotated images has same dimensions?

i.e. if the original image has 50 rows and 30 columns then the rotated image should have 30 rows and 50 columns.

library(raster)
r1 <- brick("watch1.JPG")#please use any jpg image
plotRGB(r1)
png("SaveThisPlot.png")
plotRGB(t(flip(r1, 2)))
dev.off()

回答1:


png("SaveThisPlot.png",width=nrow(r1),height=ncol(r1))



来源:https://stackoverflow.com/questions/31814873/r-raster-rotating-images-and-not-changing-their-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!