ImageScan

ImageScan[f, image]
evaluates f applied to each pixel of image in turn.

Details and OptionsDetails and Options

  • The channel values supplied to f are normally in the range 0 to 1, regardless of the underlying type used in the Image object.
  • ImageScan[f, image] discards the results of applying f to the pixels in image. Unlike ImageApply, ImageScan does not build up a new image and returns Null.
  • ImageScan is useful in carrying out an operation on parts of expressions where the operation has a "side effect", such as making an assignment.
  • ImageScan works on images with any number of channels.
  • You can also use Throw to exit from ImageScan. »
  • ImageScan traverses the pixels of image in a row-wise order from left to right.
  • ImageScan 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.
  • With the setting Masking->roi, a region of interest to be scanned can be specified.
  • ImageScan works with Image3D objects.

ExamplesExamplesopen allclose all

Basic Examples (5)Basic Examples (5)

Scan pixels of a grayscale image:

Scan pixels of a color image:

Scan pixels of a 3D image:

Count the number of white pixels in an image:

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

Compute the mean pixel value:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »