How to replace the data in tif file with my own data by matlab?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rafat
am 6 Nov. 2023
Kommentiert: Sulaymon Eshkabilov
am 7 Nov. 2023
Hello,
I have .tif file, how I can replace or edit its data with my own matrix of data?
I cc'd mymatrix and the .tif file.
If you have an idea, please elaborat a littile bit on explanation how to do it, since I am beginner with matlab.
Cheers
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 6 Nov. 2023
Bearbeitet: Walter Roberson
am 6 Nov. 2023
The file you have appears to be a GeoTIFF file, which you can read with readgeoraster or the older geotiffread
You can write out the modified data using geotiffwrite
geotiffinfo might also be of interest.
4 Kommentare
Walter Roberson
am 7 Nov. 2023
Bearbeitet: Walter Roberson
am 7 Nov. 2023
The file appears to contain a __MACOSX subdirectory.
pwd
ls -la
!zipinfo -1 Test5.zip
D=unzip('Test5.zip')
ls -la
Weitere Antworten (1)
Sulaymon Eshkabilov
am 6 Nov. 2023
If understood your question correctly, this is how to get it solved:
D=unzip('Test5.zip');
%%
D1 = imread(D{1,1});
DS = load(D{1,3}).image_median;
subplot(211);imagesc(D1); title('doy2019190052709_aid0001.tif')
subplot(212); imagesc(DS); title('mymatrix.mat')
[X, Y] = find(DS(:,:,1)>0.9);
D1(X,Y,:)=DS(X,Y,:);
%%
figure
imagesc(D1); title('Updated TIFF file')
saveas(gcf, 'UPDATED.tiff') % Save the updated image data
5 Kommentare
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!