我無法在線查找有關由多個2D圖像組成的3D圖像的亮度重新縮放的信息。如何使用Matlab重新縮放灰度三維圖像(x,y,z)的亮度範圍
我在尋找與imadjust
相同的功能,它只適用於2D圖像。
我的3D圖像是堆疊在一起的2D圖像的組合,但我必須逐一處理3D圖像而不是2D圖像。
我無法循環imadjust,因爲我想將圖像作爲一個整體來處理,以便在所有方向上考慮所有可用信息。
我無法在線查找有關由多個2D圖像組成的3D圖像的亮度重新縮放的信息。如何使用Matlab重新縮放灰度三維圖像(x,y,z)的亮度範圍
我在尋找與imadjust
相同的功能,它只適用於2D圖像。
我的3D圖像是堆疊在一起的2D圖像的組合,但我必須逐一處理3D圖像而不是2D圖像。
我無法循環imadjust,因爲我想將圖像作爲一個整體來處理,以便在所有方向上考慮所有可用信息。
對於申請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{:})
爲3D圖像做到這一點的唯一方法是把數據作爲載體,然後重塑回來。
事情是這樣的:
%create a random 3D image.
x = rand(10,20,30);
%adjust intensity range
x_adj = imadjust(x(:), size(x));
檢查編輯..沒有我的解決方案爲您工作? –
是的,我看到你的編輯,我改變了一兩句話。我無法直接從您的建議中找到編輯我的問題的功能......因爲我猜這確實會讓您贏得聲望? – Sarahdata
哈哈!其實我指的是編輯我的答案..它是否適合你?你嘗試過嗎? –