Learn R Programming

screenshot (version 0.9.2)

crop_image: Cut off a part of image from a whole image.

Description

Cut off a part of image from a whole image.

Usage

crop_image(image, pos_x, pos_y, w = 50, h = 20)

hay2needle(image, pos_x, pos_y, w, h)

Value

          An image of cimg object.

Arguments

image

An image of cimg.

pos_x, pos_y

A numeric to indicate the top left corner of cutting image. When NULL, position will be randomly sampled.

w, h

A numeric for width or height of the cutting image.

Examples

Run this code
image <- imager::load.example("parrots")
croped_image <- crop_image(image, 200, 250, 100, 50)
layout(c(1:2))
plot(image)
plot(croped_image)

Run the code above in your browser using DataLab