# Reduce the resolution of satellite imagery data for use in MATLAB

When I am using the 4-band multi-spectral data for NDVI calculation, after successful completion of runtime, it shows some warning message like "Loading 17%..."

How should I rectify it? Should I do any filtering for reducing the resolution effect before processing?

If you have gdal command line setup you can try this:

gdal_translate -outsize xsize[%] ysize[%] <src_dataset> <dest_dataset>


Example: creating 25% of original image.

gdal_translate -otusize 25% 25% input.tif output.tif


......

The problems you are encountering are likely a result of your MATLAB code used to create NDVI. There should be no need for filtering or resampling to lower resolution. The following code is what I use in MATLAB to create NDVI from 4-band NAIP imagery at both half meter and 1 meter spatial resolution.

file = 'F:\input\4211258_se.tif';
outputdir = 'F:\output\ndvi\'

%% Make NDVI calculations
NIR = im2single(I(:,:,4));
red = im2single(I(:,:,1));
ndvi = (NIR - red) ./ (NIR + red);
ndvi = double(ndvi);

%% Stretch NDVI to 0-255 and convert to 8-bit unsigned integer
ndvi = floor((ndvi + 1) * 128); % [-1 1] -> [0 256]
ndvi(ndvi < 0) = 0;             % not really necessary, just in case & for symmetry
ndvi(ndvi > 255) = 255;         % in case the original value was exactly 1
ndvi = uint8(ndvi);             % change data type from double to uint8
% Imag = double(ndvi)
% Imag1 = sparse(Imag);

tiffdata = geotiffinfo(file);
outfilename = [outputdir 'ndvi_' '4211258_se' '.tif'];
geotiffwrite(outfilename, ndvi, R, 'GeoKeyDirectoryTag', tiffdata.GeoTIFFTags.GeoKeyDirectoryTag)