ImageFileFilter

ImageFileFilter[f,inputfile,r,outputfile]

applies the function f to the range r neighborhood of each pixel in each channel of the image stored in inputfile and stores the result in outputfile.

Details and Options

  • ImageFileFilter can be used to read, process, and write successive blocks of data from a very large image file whose size could exceed available memory.
  • ImageFileFilter[f,inputfile,r] stores the result under the "Image" directory in $WolframDocumentsDirectory.
  • ImageFileFilter works with TIFF, JPEG, and PNG files. The created outputfile always has the same file format, data type, and dimensions as the inputfile.
  • ImageFileFilter works on images with any number of channels.
  • The image files inputfile and outputfile can be given as a string or a File object.
  • ImageFileFilter[f,inputfile,r] replaces the value of each pixel by the result of applying the function f to the × array of values around that pixel.
  • ImageFileFilter[f,"inputfile",{rrow,rcol}] uses range rrow in the row direction, and rcol in the column direction.
  • The function f should always 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.
  • ImageFileFilter operates separately on each channel in an image.
  • The following options can be given:
  • Interleaving Truewhether to supply f lists of channel values
    Padding"Fixed"what values to assume beyond the image
    Method Automaticmethod to use
  • The following suboptions can be given to Method:
  • "ImageList"Allframes to process from a multi-frame file
    "MaxBlockSize"8000000maximal size of image blocks in pixels loaded into the memory
  • With the default setting Interleaving->False, the elements in the arrays to which f is applied are individual channel values for the pixels.
  • For the most efficient file processing, stripes or tiles of the image may be accessed in a specific order.
  • The value of the option "MaxBlockSize" may be exceeded if it is smaller than the smallest block supported for the input file.
  • With "ImageList"->{l1,l2,}, the output image only contains the processed frames.
  • Padding->None is not supported by ImageFileFilter.

Examples

open allclose all

Basic Examples  (2)

Out-of-core processing of an image:

Thumbnail of the resulting image:

Specify the output file name:

Options  (2)

Interleaving  (1)

Compute the average over all channels using Interleaving->True:

Thumbnail of the resulting image:

Method  (1)

Apply the function only to one frame of a multi-image file using "ImageList":

Apply the function to a list of frames:

Applications  (1)

Out-of-core correlation with a Gaussian kernel:

Thumbnail the resulting image:

Wolfram Research (2012), ImageFileFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageFileFilter.html (updated 2020).

Text

Wolfram Research (2012), ImageFileFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageFileFilter.html (updated 2020).

CMS

Wolfram Language. 2012. "ImageFileFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/ImageFileFilter.html.

APA

Wolfram Language. (2012). ImageFileFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageFileFilter.html

BibTeX

@misc{reference.wolfram_2023_imagefilefilter, author="Wolfram Research", title="{ImageFileFilter}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ImageFileFilter.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_imagefilefilter, organization={Wolfram Research}, title={ImageFileFilter}, year={2020}, url={https://reference.wolfram.com/language/ref/ImageFileFilter.html}, note=[Accessed: 19-March-2024 ]}