ImageApplyIndexed

ImageApplyIndexed[f,image]
applies the function f to the list of channel values for each pixel in image, giving the row and column index of each pixel as a second argument to f.

ImageApplyIndexed[f,{image1,image2,}]
applies f to the sequence of corresponding pixel values taken from each , giving the corresponding row and column index of pixels as the last argument to f.

Details and OptionsDetails and Options

  • ImageApplyIndexed[f,image] replaces the list of channel values for each pixel by the result of applying the function f to the list.
  • In 2D, the part specification of each pixel is passed to f as .
  • In 3D, the part specifications are specified with .
  • ImageApplyIndexed works on images with any number of channels.
  • ImageApplyIndexed returns an image of the same type as image.
  • In ImageApplyIndexed[f,image], the function f can return a number or a list of any length.
  • The channel values supplied to f are normally in the range 0 to 1, regardless of the underlying type used in the Image object. The function f is assumed to return channel values that are normally in the range 0 to 1.
  • In ImageApplyIndexed[f,{image1,image2,,imagen}], f is supplied with arguments.
  • ImageApplyIndexed[f,{image1,image2,}] works with any number of commensurate images.
  • ImageApplyIndexed[f,{image1,image2,}] gives an image with the largest type of , clipping or truncating values if necessary.
  • ImageApplyIndexed has the option Interleaving, which specifies whether f should be applied to individual channel values or to the complete list of channel values for a given pixel. The default setting is Interleaving->True.
  • ImageApplyIndexed works with Image3D objects.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Apply a pure function defined on the pixel's value and position:

In[2]:=
Click for copyable input
Out[2]=

Apply a function depending on the pixel's values and position to a list of images:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)