# NOT RUN {
############
### EG 1 ###
############
## example where you know where to crop the image
sakurajima.crop <- crop.image(sakurajima,xleft=146,ybottom=7,xright=203,ytop=256)
split.screen(c(1,2))
screen(1)
image2(sakurajima,asp=1,main='Original')
screen(2)
image2(sakurajima.crop[[1]],asp=1,main='Cropped')
## close screens
close.screen(all.screens=TRUE)
############
### EG 2 ###
############
## example where you choose where to crop using interactive plot
sakurajima.crop <- crop.image(sakurajima)
split.screen(c(1,2))
screen(1)
image2(sakurajima,asp=1,main='Original')
screen(2)
image2(sakurajima.crop[[1]],asp=1,main='Cropped')
print(sakurajima.crop[[2]])
## close screens
close.screen(all.screens=TRUE)
# }
Run the code above in your browser using DataLab