3D image from 10rgb slices
1 次查看(过去 30 天)
显示 更早的评论
Hi I have 10 rgb images (100x 100x 3) and want to combine them into a single 3D image. Is it possible ? thanks in advance Sermed
回答(3 个)
Image Analyst
2013-1-25
How do you want to combine them? Do you want a single x00x100x3 image that is the average of all of them? If so, cast them to double and add them, then cast back to uint8 (if that's how they started).
aveImage = uint8((double(image1) + double(image2) + ... + double(image10))/10);
0 个评论
Thorsten
2013-1-25
Because RGB is already 3D, you can combine them in the fourth dimension
I1 = ones(10, 10, 3);
I2 = 2*ones(10, 10, 3);
All(:,:,:,1) = I1;
All(:,:,:,2) = I2;
or you can stack them one after the other in the third dimension:
All(:,:,1:3) = I1;
All(:,:,4:6) = I2;
or you can use cells
All{1} = I1;
All{2} = I2;
0 个评论
Youssef Khmou
2013-1-27
Hi, here is an other viewpoint that combines the two given answers : you create an Image_Stack and then do what you prefer like median, mean ... :
Stack=zeros(100,100,3,10);
% ur first image I1
Stack(:,:,:,1)=im2double(I1);
%..and so on until 10
Stack(:,:,:,10)=im2double(I10);
Sum=zeros(100,100,3);
for iter=1:10
Sum=Sum+Stack(:,:,:,iter);
end Combined=Sum/10;
I hope that helps .
KH.Youssef
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!