How to convert 2D to 3D?
5 views (last 30 days)
Show older comments
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
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()???
Accepted Answer
Walter Roberson
on 4 Apr 2013
if ndim(TheArray) == 2
TheArray = TheArray(:,:,[1 1 1]);
end
13 Comments
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.
More Answers (0)
See Also
Categories
Find more on Red in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!