I'm trying to split an 350x450x50 image into 350x400x10 and i'm getting the following error while saving the .tif file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
>> 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{:});*
0 Kommentare
Antworten (1)
Walter Roberson
am 9 Mär. 2016
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with Image Processing Toolbox 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!