How to convert 2D to 3D?

5 views (last 30 days)
janepear
janepear on 4 Apr 2013
Hi, I have some pictures, some of them are 2D and some are 3D. I need to convert 2D to 3D if I choose to open 2D picture( because I use histeq and imhist) I don´t know how to do write a command for converting to 3D if it is needed and not if is choosen 3D picture.
Thanks a lot
jane
p.s: sorry for my english
  1 Comment
Image Analyst
Image Analyst on 4 Apr 2013
histeq() (a pretty much useless function by the way) and imhist() require 2D (grayscale) images, not 3D (color) images, so why do you want to convert to 3D/color if you say you're going to use histeq() and imhist()???

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Apr 2013
if ndim(TheArray) == 2
TheArray = TheArray(:,:,[1 1 1]);
end
  13 Comments
Image Analyst
Image Analyst on 4 Apr 2013
This is not the larger picture. What does this code do? Why are you trying to somehow do something with a bone colormap? What do you want as a final image, handles.cm? A color image, an indexed image, or a grayscale image? It looks like a grayscale image so you only need to do that if ndims(handles.imga) == 3. But even if you do it only for color images, I'm not sure why a bone colormap is involved when you end up as grayscale.
janepear
janepear on 4 Apr 2013
Edited: janepear on 4 Apr 2013
1.)I want to show what you can do with utrasound picture...I use colormaps to show that sometimes is better to use copper or summer or another coloration of image

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!