divideImage

Share:

Description

Divide an image into a number of smaller images

Usage

1
divideImage(image, columns, rows)

Arguments

image

A raster image

columns

The number of columns to divide the image into.

rows

The number of rows to divide the image into.

Details

It can be useful to examine sections of an image separately. This function allows images to be broken down for such analysis. Note that if the image cannot be divided exactly into the number of rows and columns specified, some images may have different dimensions from others.

Value

A matrix of raster images. Elements of the matrix must be accessed using [[.

Examples

1
2
3
4
5
6
7
library(CulturalAnalytics)
library(jpeg)
imgdir<-paste(system.file(package = "CulturalAnalytics"), "images", sep = "/")
imgs<-paste(imgdir, dir(path = imgdir, pattern = ".jpg"), sep = "/")
img<-readJPEG(imgs[1])
tiles<-divideImage(img, 3, 3)
t13<-tiles[[1,3]]

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.