How to save image matrix into structure format for different simulation?
4 ビュー (過去 30 日間)
古いコメントを表示
for simulation = 1:iteration
disp('Starting Simulation');
for dates = 1%:100
for bands = [1 2 3 4]
Imfiles_Bands = dir(fullfile(filepath,date(dates).name,'L1C2','*B1.TIF')); %listing the file of band 1
Imfiles = dir(fullfile(filepath,date(dates).name,'L1C2',[Imfiles_Bands.name(1:end-5),num2str(bands),'.TIF']));
[A, R] = geotiffread(fullfile(Imfiles.folder,Imfiles.name)); % reading the tif file from band 1 to 7, and getting the name of the file, except the last five characters that are the name of the band
RMUL = 0.0002;
RADD = -0.2;
%calculating TOA reflectance
TOA_REF = ((RMUL)*(single(A))+(RADD));
%Croping the image
targetSize = [500 800];
r = centerCropWindow2d(size(TOA_REF),targetSize);
Cropped_SR = imcrop(TOA_REF,r); % I obtained the matrix size of 500X800
disp('Image Cropped');
%% Here I don't know how save this matrix, so can guys please help me?
SurRef_simulated(bands).SR(simulation) = Cropped_SR;
clear A RMUL RADD ImfilesTOA_REF ROI
end
end
clear date_dir
save('Simulated300_Surface_Reflectance_MSS5_P39R37_5th','SurRef_simulated', '-v7.3');
end
Above is my code where I am calculating reflectance and then cropping the image as per my interest. After obtaining the cropped image I want save that matrix for every simulation and bands. I thought to save it in structure format but I am getting error, so can you guys help me to figure out how to save this cropped image matrix.
回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!