how to make a slice of multiple images in 3d

I have these three images meterology. First image is weather chat of 100m, second is of 200m, thrid is of 300m.
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
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.
Can some one tell me how i can do this 3d slicing of images?

8 Comments

What difference is there between this question and your previous question on this topic, which you have now deleted?
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.
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.
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..
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?
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.
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.
some other may assist please

Sign in to comment.

Answers (1)

Try using "hold on" in your loop.

17 Comments

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)
problem is in why i am creating surface? Here i only need to hand up 100m image to it z-axis....
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?
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
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().
No I am not using any from this function.please look up my code
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
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.
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.
i am using matlab (2013) image proccessing tool box as tool for these images.
I just haven't had the time to devote to you. Vacations, plus backlog at work, etc.
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!
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.
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
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.
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
Muhammad Usman Saleem comments to Image Analyst's response of 30 Jun 2016
not of the solution to this problem

Sign in to comment.

Asked:

on 25 Jun 2016

Commented:

on 13 Jul 2016

Community Treasure Hunt

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

Start Hunting!