You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
how to make a slice of multiple images in 3d
1 view (last 30 days)
Show older comments
I have these three images meterology. First image is weather chat of 100m, second is of 200m, thrid is of 300m.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154446/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154448/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154449/image.jpeg)
I have these three images meteorology. First image is weather chat of 100m, second is of 200m, third is of 300m
This is roughly prototype of my idea what i want
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154450/image.png)
Both longitude and latitude are same in three images, I want to just makes longitude as x - axis, latitude as y axis and 100m image at 100, 200m image at 200 ....
i able to producce this code,
a=imread('100.jpg');
b=imread('200.jpg');
c=imread('300.jpg');
I = cat(4,a,b,c);
data = importdata('gpheight300.txt') ;
x = data(:,1) ; x = unique(x) ;
y = data(:,2) ; y = unique(y) ;
%# coordinates
[X,Y] = meshgrid(1:size(I,2), 1:size(I,1));
%[X,Y]=meshgrid(x,y);
Z = ones(size(I,1),size(I,2));
kin=[100 200 300];
for k=1:length(kin)
surface('XData',X, 'YData',Y, 'ZData',Z.*kin(k), ...
'CData',I(:,:,k), 'CDataMapping','direct', ...
'EdgeColor','none', 'FaceColor', 'texturemap')
% patch('XData',X, 'YData',Y, 'ZData',Z.*kin(k),'CData',I(:,:,k))
end
%colormap(cmap)
view(3), box on, %axis tight square
%set(gca, 'YDir','reverse', 'ZLim',[0 size(I,3)+1])
saveas(gcf,'3d','jpg');
This code producing surface in which all three images becomes brown color,(wrapped) when i save them just is this blank 3d block save appear.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154452/image.jpeg)
Can some one tell me how i can do this 3d slicing of images?
8 Comments
Walter Roberson
on 25 Jun 2016
What difference is there between this question and your previous question on this topic, which you have now deleted?
Muhammad Usman Saleem
on 26 Jun 2016
please some body guide me about how can i resolve this problem? I do not know why people do not share their knowledg, Always a good learner is who have the time instant solution and sharing of knowledge with other. Any help will be appricible.
Walter Roberson
on 27 Jun 2016
Sometimes people are distracted. Or ill. Or just not interested in the topic. Or do not understand the question. Or do not feel that they have anything to contribute to the question. Or are in a bad mood. Or feel like the poster had not put in enough effort. Or have other things to do on a weekend. Or feel like the question is "too big" for the attention they feel up to paying.
Muhammad Usman Saleem
on 27 Jun 2016
Edited: Muhammad Usman Saleem
on 27 Jun 2016
Knowledge always learn after sharing with other...
Its lame excuses to not assist =D
knowledge is the only thing which can not be steal but always increase after sharing..
Walter Roberson
on 27 Jun 2016
We are volunteers. We don't need excuses. If we do not feel like contributing, we don't have to contribute. If it isn't fun for us, then we can turn our attention elsewhere and you have no grounds for grumbling.
For example I have many months worth of home repairs that should be done, including items that the city inspectors would probably order me to fix immediately if they ever happened to come by. If you are implying that I "owe" my volunteering to you or anyone, then why do I not see you at my home fixing my roof for free?
Walter Roberson
on 30 Jun 2016
Muhammad Usman Saleem comments, in response to my "We are volunteers" post:
some body guide these seniors voluntars , try to resolve this questions, instead of giving personal views and irrelevant posting on this question. I shall be very thankful for this kind favor.
Walter Roberson
on 30 Jun 2016
Muhammad, if Mathworks ever instituted a policy that the volunteers were not permitted to give personal views, then I would stop volunteering immediately; perhaps I would go back to the Usenet Group, which would certainly not have such a restriction.
Answers (1)
Image Analyst
on 26 Jun 2016
Try using "hold on" in your loop.
17 Comments
Muhammad Usman Saleem
on 26 Jun 2016
Edited: Muhammad Usman Saleem
on 26 Jun 2016
thanks for you reply. No actually there is problem in surf function. All images after setting in vertical ways becomes brown in color. I try holding on after for loop before surf but results remains as usually wrong.
I use
saveas(gcf,'3d','jpg');
to save this space. But it save a black 3 d block instead of this image(check it and how my original images has becomes brown)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/183898/image.jpeg)
Muhammad Usman Saleem
on 26 Jun 2016
problem is in why i am creating surface? Here i only need to hand up 100m image to it z-axis....
Image Analyst
on 26 Jun 2016
What is a "100m image"? I don't know what "need to hand up 100m image to it z-axis" means. What do you mean by hand? Like "hand over" as in to deliver something??? How do you do that to a z axis?
Muhammad Usman Saleem
on 27 Jun 2016
Edited: Muhammad Usman Saleem
on 27 Jun 2016
Sorry for inconvient language. It is actually hang over
I have three image(weather chats) which represent atmospheric condition on different elevations. First image for 100 m elevation , second is 200 m elevation and thrid is for 300 m elevation(if you understand let's move ahead).
I want to present these images in 3d space. Such that x axis of this 3d space becomes lon( see x-axis of these images) , y axis of the 3d space becomes lat( see y axis of images) and z axis becomes elevation like 100m, 200m, 300m.
And the image of 100m elevation hang up( as I want) horizontally along z-axis. When value of 200 comes on z axis then image of 200m elevation hang on this place....
Another problem is that using surf function all images background becomes brown..(it changing all image which I do not want) Hope you got my problem
Thank you
Image Analyst
on 27 Jun 2016
It's brown because you're probably using imagesc() instead of imshow(), and you have gray scale image. imagesc() assumes the image is indexed instead of grayscale and applies some funky colormap for some reason. Don't use imagesc(). I never do. Only use imshow().
Muhammad Usman Saleem
on 27 Jun 2016
No I am not using any from this function.please look up my code
Muhammad Usman Saleem
on 27 Jun 2016
I have again checked my code, i do not use imagesc() or imshow() function. I am just creating mesh of 1s and mesh of 0s. Then using them in surf function to hang them in horizontal plane. Image are you got my query? or not
Image Analyst
on 28 Jun 2016
I tried to run it but you forgot to attach 'gpheight300.txt' so it errored out. If you want use to try your code you'll have to give us all the data that is needed and tell us what special toolboxes might be needed.
Muhammad Usman Saleem
on 28 Jun 2016
Thanks for your reply ...
Please find three attachment which are the data source of these three images.
In each zip file you find 4 text files.
Temperature which i have shown in color map in my above images, contours of gp_height are on this color maps. Quever plot is make for winds (u,v text files) , shown in arrow in my images.
Muhammad Usman Saleem
on 28 Jun 2016
Edited: Muhammad Usman Saleem
on 28 Jun 2016
i am using matlab (2013) image proccessing tool box as tool for these images.
Image Analyst
on 29 Jun 2016
I just haven't had the time to devote to you. Vacations, plus backlog at work, etc.
Muhammad Usman Saleem
on 30 Jun 2016
Image analyst try to use delete option to remove irrelevant answer for this question. So that no matlab user get misguide by your answer( as it is not perfect and relevant answer to problem).. Matlab answer always need some good answer. I am also volentar my times on this form. Deletion of your irrelevant answer gives a chance for experts to communicate on specific problem!
Walter Roberson
on 30 Jun 2016
Image Analyst has not made any irrelevant answers to this question. His replies have reflected the available information at the time.
This site is not just about Questions and final solutions: the parts that show how the solution was arrived at can be as important. Imagine, for example, a book that had a list of integrals and a list of their solutions: such a book has some use as reference tables, but more important to most people is a book that shows the key steps needed to arrive at the solution to the integrals.
Image Analyst
on 30 Jun 2016
I really don't know what you want. You're taking individual color channels and then apparently trying to display them as surfaces with some colormap for some reason. Perhaps you should look at this: http://www.mathworks.com/matlabcentral/fileexchange/29485-meshcanopy
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/183964/image.jpeg)
Walter Roberson
on 30 Jun 2016
Muhammad Usman Saleem comments on my response, above:
some body guide these seniors voluntars , try to resolve this questions, instead of giving personal views and irrelevant posting on this question. I shall be very thankful for this kind favor.
Muhammad Usman Saleem
on 1 Jul 2016
Edited: Muhammad Usman Saleem
on 1 Jul 2016
i got this code example from google, where author use index map instead of rgb image then use surf function. Which i really do not know why? What function can we use with rgb?
the link is not of my use, bz i am not using gray scale image
Walter Roberson
on 13 Jul 2016
Muhammad Usman Saleem comments to Image Analyst's response of 30 Jun 2016
not of the solution to this problem
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)