How do I work with large NITF (National Imagery Transmission Format) files?

I see that nitfread has a PixelRegion option to read part of an image, and I know about the blockedImage infrastructure to process large images. How do I use them together?

 Accepted Answer

The blockedImage infrastructure allows for 'custom adapters' to connect arbitrary data sources into the blockedImage framework for processing large images.
%% Process Large NITF SAR Imagery with blockedImage
% Download a 197 MB SICD (complex SAR) file from NGA's public sample set:
% websave("sicd_HH.nitf", "https://six-library-github-public.s3.us-east-2.amazonaws.com/sicd_example_1_PFA_RE32F_IM32F_HH.nitf")
% Open as a blockedImage using the NITF adapter (no full load into memory)
bim = blockedImage("sicd_HH.nitf", Adapter=NITFAdapter);
% Compute SAR magnitude (dB) block-by-block — works on arbitrarily large files
% Can be parallelized across a cluster with UseParallel=true
bMag = apply(bim,...
@(bs) 20*log10(abs(complex(bs.Data(:,:,1), bs.Data(:,:,2))) + 1));
% Visualize with dynamic range scaling
imageshow(bMag, DisplayRange=[30 80], Colormap=hot(256));
title("SAR Magnitude (dB) — " + bim.Size(1) + "×" + bim.Size(2) + " pixels");
Note: this adapter was created using the matlab-process-large-images skill! You can use this skill to further customize this adapter to suit your specific processing needs.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!