Merging 10 tif files into one in order to get spectral signatures

조회 수: 13 (최근 30일)
Melisa Isgro
Melisa Isgro 2020년 8월 12일
댓글: Raunak Gupta 2020년 8월 24일
Hi to everyone!
Im working with 10 reflectance maps processed on Pix4D, they have TIF format. I want to see the spectral signature of some pixels and for that I need to merge the 10 bands. How can I do this? Is this the way to proceed?
Thank you!!!

답변 (1개)

Raunak Gupta
Raunak Gupta 2020년 8월 16일
Hi Melisa,
You can read the TIFF files one by one and assign them to a matrix in the 3rd dimension. Since you want to merge the 10 images in band wise fashion, I am assuming the Height and width of every TIF image is same otherwise assigning to a matrix will not work. Below example code might be helpful. Here I assume each TIFF file contains only one channel. You may change accordingly if it contains more channels.
img1 = imread('tif_image1.tif');
[Height,Width] = size(img1,[1,2]);
numberOfBands = 10;
fullImage = zeros(Height,Width,numberOfBands);
% Assuming filename is calculated using dir and fullfile
for i=1:numberOfBands
img = imread('filename_i.tif');
fullImage(:,:,i) = img(:,:,1);
end
  댓글 수: 2
Melisa Isgro
Melisa Isgro 2020년 8월 24일
thank you for your answer! can you tell me how to use dir and fullfile?
Raunak Gupta
Raunak Gupta 2020년 8월 24일
Hi Melisa,
This answer will help using the dir and fullfile for reading and getting the name of the file.
Here F is the 'filename_i.tif' that I mentioned in the answer.
Hope this clarifies.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by