I'm trying to split an 350x450x50 image into 350x400x10 and i'm getting the following error while saving the .tif file

조회 수: 1 (최근 30일)
>> I_d = double(imread('abcde.tif'));
>>b1 = I_d(:,:,1:10);
>>X = reshape(b1,size(b1,1)*size(b1,2),10);
>>[n m] = size(X);
>>AMean = mean(X);
>>AStd = std(X);
>>B = (X - repmat(AMean,[n 1])) ./ repmat(AStd,[n 1]);
>>[V D] = eig(cov(B));
>>cumsum(flipud(diag(D))) / sum(diag(D));
>>PC = B * V;
>>var(PC);
>>VReduced = V(:,3);
>>PCReduced = B * VReduced;
>>PCReduced * VReduced';
>>Z = ((PCReduced * VReduced') .* repmat(AStd,[n 1])) + repmat(AMean,[n 1]);
>> d = permute(reshape(X, 350, 10, 400), [1 3 2]);
>> e = permute(reshape(Z, 350, 10, 400), [1 3 2]);
>> X_1 = uint8(d);
>> Z_1 = uint8(e);
>> imwrite(X_1,'1-10.tif')
*Error using writetif (line 40)
Writing TIFFs with 10 components is not supported with IMWRITE. Use Tiff instead. Type "help Tiff" for more information.
Error in imwrite (line 472)
feval(fmt_s.write, data, map, filename, paramPairs{:});*

답변 (1개)

Walter Roberson
Walter Roberson 2016년 3월 9일
It is not possible to imwrite() TIFF with more than 3 channels. You need to use the Tiff() class and choose one of the several different ways that TIFF can store additional data.

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by