对于申请imadjust为集2D取整数值考虑灰度图像的,这招可能会奏效
a = imread('pout.tif');
a = imresize(a,[256 256]); %// re-sizing to match image b's dimension
b = imread('cameraman.tif');
Im = cat(3,a,b);
%//where a,b are separate grayscale images of same dimensions
%// if you have the images separately you could edit this line to
%// Im = cat(2,a,b);
%// and also avoid the next step
%// reshaping into a 2D matrix to apply imadjust
Im = reshape(Im,size(Im,1),[]);
out = imadjust(Im); %// applying imadjust
%// finally reshaping back to its original shape
out = reshape(out,size(a,1),size(a,2),[]);
检查:
x = out(:,:,1);
y = out(:,:,2);
正如你可以从工作区中看到图像,第一个图像(变量x)未重新缩放至0-255,因为其先前范围(变量a)未接近0点。
工作区:
编辑:你可以这样做,因为这样的一个步骤:(因为对方的回答暗示)
%// reshaping to single column using colon operator and then using imadjust
%// then reshaping it back
out = reshape(imadjust(Image3D(:)),size(Image3D));
编辑2:
正如你在I2形象电池阵列,试试这个:
I2D = cat(2,I2{:})