# Convert 2D image into 3D (to get the x y z coordinates of the image)

4 Ansichten (letzte 30 Tage)
Kajimusugura Hoshino am 26 Okt. 2020
Kommentiert: jahnavi s am 28 Mär. 2021
I know there have been similar articles related to this but I am not sure if those articles can help me with what I am trying to do.
So I have a regular png 2D image which I want to convert into 3D image so that I can get the x y and z coordinates. Basically, I need those coordinates in order to calculate some volume.
What should be the appraoch to start this?
##### 2 KommentareKeine anzeigenKeine ausblenden
Athul Prakash am 30 Okt. 2020
Bearbeitet: Athul Prakash am 30 Okt. 2020
I couldn't understand your question clearly. What do you mean by 3D image to 2D? Are you talking about the number of channels, i.e. converting from greyscale to color perhaps?
jahnavi s am 28 Mär. 2021
@Kajimusugura Hoshino, Sir i did u got answer for converting 2D image to 3D, canu please share how to do it if u have done it

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

drummer am 30 Okt. 2020
Tecnically, with only one single 2D image, you cannot obtain a tridimensional image.
As you might know, a 2D image has [x, y] dimensions. You can see it by calling
size(yourPNGimageFile) % It will return a vector of two values (x and y)
The z dimension (that represents real data) come from a volumetric (3D) image.
>>size(brainScan) %example of volumetric image of x = 128, y = 128, z 256
ans =
128 128 256
if you pick
brainScan(:, :, 45) % It means you're taking all x, all y and a single slice of the volume (the 45th).
So the way around is possible: to get a 2D image out of a stack of slices in a 3D-image volume.
YOU CAN make a stack of your png 2D images. But it would not make sense, as it will be a stack of repeated images.
yourStack(:, :, 1) = yourPNGfile;
yourStack(:, :, 2) = yourPNGfile; % Then, you have your x, y and z coordinates.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Image Arithmetic 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!

Translated by