How can i convert a 3D image to 2D in matlab?
Mostra commenti meno recenti
I am using a code that will work only on 2D arrays and I have to convert the current image which is in 3D to 2D.
Risposte (2)
Image Analyst
il 20 Feb 2012
Modificato: Image Analyst
il 28 Feb 2014
If the 3D image is a color image, you can take individual color channels like this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Or you could use a weighted average of the red, green, and blue channels like this:
grayImage = rgb2gray(rgbImage);
Or if you have a volumetric image (like a CT or MRI image or other image distributed in 3 spatial dimensions) you can use the mean (or max or min) like this
xyImage = mean(volumeImage, 3);
xzImage = mean(volumeImage, 2);
yzImage = mean(volumeImage, 1);
They will get you the average of the 3D volumetric image projected along one of the dimensions.
7 Commenti
greatest
il 3 Apr 2012
I have a MRI image.what do we do after we find the avg along the 3 dimensions?
Image Analyst
il 3 Apr 2012
I don't know. Maybe declare victory and publish it?? Once you have the mean projection image along some axis, it seems like it would be all blurred and I don't know what use it would be. Maybe instead you want to take just one slice out of it, or maybe you want to use the maximum intensity value projection instead of the mean. Only you know what you want to do.
VIJAY
il 28 Feb 2014
rgb2tiff not found in matlab 2013a... What to do now...???
Image Analyst
il 28 Feb 2014
Sorry - I meant rgb2gray(). I corrected it. Try that.
hidangmayum saxena
il 16 Apr 2015
Modificato: Image Analyst
il 16 Apr 2015
How to divide a 3D anaglyph image into blocks, after taking the multilevel discrete wavelet transform of it?
Image Analyst
il 16 Apr 2015
Mihirasree
il 9 Nov 2022
thank you soo much sir your suggestions helping us all a lot . Thanks for helping us
Dinesh kumar
il 13 Nov 2016
1 voto
please answer me the coding for how to convert a 3d image into 2d image
4 Commenti
Image Analyst
il 14 Nov 2016
There are so many ways I can't list them all. Why don't you tell us
- what you want to do,
- and if your image is a 3D volumetric image, like a CT or MRI data set, or if it's a color image.
Galiyabi P S
il 24 Gen 2017
Sir, Can you help me to convert 3D image to 2D, if the image is a MRI image of mha format.
Walter Roberson
il 24 Gen 2017
https://www.mathworks.com/matlabcentral/answers/122486-how-can-i-load-and-view-medical-image-mha to read it. You can then extract slices of the result using array indexing.
Galiyabi P S
il 29 Gen 2017
Thanks Walter Roberson for your answer. It helps me to read and display the mha image. Can you help me to convert these images to rgb format?
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!