Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

When I am using the 4-band multispectral 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?

Thanks in advance.

share|improve this question

2 Answers 2

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

......

share|improve this answer

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';
[I R] = geotiffread(file);
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) 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.