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

11 ビュー (過去 30 日間)
Kajimusugura Hoshino
Kajimusugura Hoshino 2020 年 10 月 26 日
コメント済み: jahnavi s 2021 年 3 月 28 日
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 件のコメント
Athul Prakash
Athul Prakash 2020 年 10 月 30 日
編集済み: Athul Prakash 2020 年 10 月 30 日
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
jahnavi s 2021 年 3 月 28 日
@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

サインインしてコメントする。

回答 (1 件)

drummer
drummer 2020 年 10 月 30 日
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by