.mat file w/ vertices of 3D image inputted into axes in GUI

I have a GUI with an axes box, and I have a file V.mat which contains the vertices of a 3D image. How do I make this 3D image show up in the axes?

3 Commenti

What is a "3d image" for this purpose?
"a point cloud" [x, y, z] of a pressure ulcer, obtained by projecting Structured Light patterns on a wound and capturing via webcam the distortions in the pattern
V.mat is a 49358 x 3 matrix of 0's and 1's

Accedi per commentare.

 Risposta accettata

pointsize = 20; %adjust as needed
scatter3(V.mat(:,1), V.mat(:,2), V.mat(:,3), pointsize)
However I am confused now about whether it is [x, y, z] coordinates, or if it is "0's and 1's": if it is 0's and 1's then it is not clear what the x y or z values would be.

6 Commenti

Walter, I don't know if you're familiar w/ GUI functioning (I certainly am not), but I need to insert some type of handle for it to work, I think the term GCBO is relevant. I'm going to look into it. But this does not produce results
Running it in the command window gives this, despite V.mat existing in the workspace
Walter was not being literal when he was saying to use V.mat(:,1). He was saying you can
scatter3(V(:,1), V(:,2), V(:,3), pointsize)
what is point size supposed to represent?
size represents the size of the point in the scatter plot
You had posted "V.mat is a 49358 x 3 matrix of 0's and 1's" so yes, I did mean V.mat
Perhaps what you meant was that the file V.mat contains a variable that has that structure. If so then we would need to know the name of the variable in order to code appropriately. You can use
whos -file V.mat
in order to see the list of variables in the file.
With regards to loading the data in one place and plotting it in another:
I still don't understand how your (x,y,z) and color are to relate together to be plotted.

Accedi per commentare.

Più risposte (1)

From your screenshot you will not be able to do it there. Are you trying to plot this when it opens? Push of a button?
Where ever you are trying to do this you need to do something like this
handles.axes1; %handles. (tag of the axes)
pointsize=20;
scatter3(V(:,1),V(:,2),V(:,3),pointsize);
now depending on where you want to do this you'll need to do it when V is defined.
When/where do you want to plot the scatter? and when/where/how is V.mat loaded?

8 Commenti

Also for clearification this is what you want to do can you paste in a screen shot of what V(1:10,:) looks like
Joseph, I have a 'Generate 3D Image' button which is of tag 'calculate'. This button should make the image appear in the axes. V.mat is loaded here in the GUI function:
then for simplicities sake
within the reset__callback after you load(V.mat):
load(V.mat);
handles.V = V; %store V within handles (dunno if this is best practices but i do it.
guidata(hObject, handles); %update handles globally so we can use it in another function.
in the calculate_callback(hObject, eventdata, handles, varargin)
V=handles.V; %don't have to do this but makes it shorter to type.
handles.axes1; %handles. (tag of the axes) : sets the active axes to the one you want to use.
pointsize=20; %set point size to 20
scatter3(V(:,1),V(:,2),V(:,3),pointsize); %scatter plot V data.
I do not know what type of plot you want for that type of data. Its definitely not a [x,y,z] unless the first 18 are just the same point. well if you figure out what type of plot/scatter/image/surface. just substitute scatter3 with what you're trying to do.
Joseph, I'm waiting on some more files before attempting to run it through the GUI. For now I'm going to just manually try and get the plot.
pointsize=20;
scatter3(V(:,1),V(:,2),V(:,3),pointsize);
returns this:
I have a COLOR.mat and an index.mat file as well that I'm now thinking relate to making this work. This is COLOR:
This is index.mat (just 1-49358):
oh ok, check back when you get more stuff. i just wasn't sure what type of 3d plot with that much data and i see you only had 3 unique points.

Accedi per commentare.

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by