Learn R Programming

imager (version 0.42.19)

get.locations: Return coordinates of subset of pixels

Description

Typical use case: you want the coordinates of all pixels with a value above a certain threshold

Usage

get.locations(im, condition)

Value

coordinates of all pixels such that condition(pixel) == TRUE

Arguments

im

the image

condition

a function that takes scalars and returns logicals

Author

Simon Barthelme

Examples

Run this code
im <- as.cimg(function(x,y) x+y,10,10)
get.locations(im,function(v) v < 4)
get.locations(im,function(v) v^2 + 3*v - 2 < 30)

Run the code above in your browser using DataLab