This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Read image from NITF file


X = nitfread(filename)
X = nitfread(filename,idx)
X = nitfread(___Name,Value)



X = nitfread(filename) reads the first image from the National Imagery Transmission Format (NITF) file specified by the character array filename. The filename array must be in the current folder or in a folder on the MATLAB® path, or it must contain the full path to the file.

X = nitfread(filename,idx) reads the image with index number idx from a NITF file that contains multiple images.

X = nitfread(___Name,Value) reads an image from a NITF image, where optional parameters control aspects of the operation.


collapse all

To run this example, replace the name of the file with the name of a NITF file on your system. You can find sample NITF files on the web.

Read the second image from a NITF file containing multiple images. The example reads a subset of the image data, starting at row, column location (100,200), reading every other value to (105,205).

subsec = {[100 2 105],[200 2 205]}

ntfdata = nitfread('your_file.ntf',2,'PixelRegion',subsec);

Input Arguments

collapse all

Name of NITF file, specified as a character vector.

Data Types: char

Index number of image in NITF file, specified as a numeric scalar of class double.

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: ntfdata = nitfread('your_file.ntf',2,'PixelRegion',{[100 2 150],[200 2 250]});

Row and column indices of pixels to be read from file, specified as a two-element cell array containing vectors of positive integers. Each element is a two-element vector of the form [start stop] or a three-element vector of the form [start increment stop], where the first vector specifies the row index and the second vector specifies the column index.

Example: {[100 150],[200 250]} — read pixels starting at row/column location (100,200) ending at location (150,250)

{[100 2 150],[200 2 250]} — read every other pixel starting at row/column location (100,200) ending at location (150,250)

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | cell

Output Arguments

collapse all

Image data from NITF file, returned as a numeric array.


  • This function supports version 2.0 and 2.1 NITF files, and NSIF 1.0 files. Image submasks and NITF 1.1 files are not supported.

See Also


Introduced in R2007b