Anyone know how to convert a .tif file with value of 7457x9853x4 uint16 to a square matrix?

25 ビュー (過去 30 日間)
Suki Dauda Sule
Suki Dauda Sule 2019 年 11 月 7 日
回答済み: Tejaswini Veduruvada 2020 年 3 月 24 日
I have a satellite image which is in tiff format so .tif file and the value is 7457x9853x4 uint16
I need to transform it to a square n x n matrix so I can run SVD on it.
I also want the command line to import such an image without clicking on 'import data'

回答 (1 件)

Tejaswini Veduruvada
Tejaswini Veduruvada 2020 年 3 月 24 日
To import the .tiff image, use “Tiff” function
A=Tiff(filename);
Image=read(A);
Or use “imread” function
Image=imread(filename);
To convert the image into 2D matrix, you can apply “svd” for individual matrix in that image and use “imresize” to obtain n*n square matrix
Or use “reshape” function, but the number of elements present in the original image is not a perfect square so cannot convert into square matrix. 2D-matrix can be obtained with different rows and columns.
Im_final=reshape(Image,[29828 9853]);

カテゴリ

Help Center および File ExchangeReference Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by