Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ploting xyz rgb

Subject: ploting xyz rgb

From: nman2084

Date: 10 Jun, 2011 23:01:04

Message: 1 of 7

I have data in this form x, y, z, r, g, b

I would like to create contour on x, y, z and color taken from r, g, b.

Is there a function that i can use or method to do this?

Subject: ploting xyz rgb

From: ImageAnalyst

Date: 11 Jun, 2011 03:31:03

Message: 2 of 7

How do you have a "contour" on a 3D color image? You mean like some
kind of isosurface? Do you need to do volumetric rendering of this
surface inside your volume, so that your volume need to be translucent
so your surface can be seen inside the total volume? If so, you may
need a true volume rendering program like Avizo, because MATLAB can't
do that.

Subject: ploting xyz rgb

From: nman2084

Date: 11 Jun, 2011 04:09:04

Message: 3 of 7

Ok, I am satisfied to do contour only on x, y but colors should be used from r,g, b from the input file. It seems i don't need volume just need area, so how do i use x, y, r, g, b to do color contour.




ImageAnalyst <imageanalyst@mailinator.com> wrote in message <1d84a923-0a6e-4e05-9ec9-45a6310aa2a5@m10g2000yqd.googlegroups.com>...
> How do you have a "contour" on a 3D color image? You mean like some
> kind of isosurface? Do you need to do volumetric rendering of this
> surface inside your volume, so that your volume need to be translucent
> so your surface can be seen inside the total volume? If so, you may
> need a true volume rendering program like Avizo, because MATLAB can't
> do that.

Subject: ploting xyz rgb

From: ImageAnalyst

Date: 11 Jun, 2011 04:37:03

Message: 4 of 7

I still don't understand. So let's say you have a directed contour,
(x1,y1) going to (x2,y2) going to (x3,y3) and so on. Now let's say
that point 1 has an RGB color associated with it (from your list), and
point 2 has another, different color, and so on. Now, does color1
mean that line 1 going from point1 to point2 should be color1, and
line 2 going from point 2 to point 3 should be color 2, and so on? So
that your contour has different colors for each line segment going
between each pair of vertices? If so, just use line() to build up
your contour.

Subject: ploting xyz rgb

From: nman2084

Date: 11 Jun, 2011 04:49:05

Message: 5 of 7

I wanted something like plot x, y point cloud, so each point has r, g, b color values. So it is more like scatter plot but color each point is defined by r, g, b.

Sorry i created misunderstanding with contour, is there way to plot x, y, (z if it is possible), with each individual point with color defined by r, g, b.

Subject: ploting xyz rgb

From: ImageAnalyst

Date: 11 Jun, 2011 13:53:57

Message: 6 of 7

Take a look at scatter3()

scatter3(X,Y,Z,S,C)

"C determines the color of each marker. When C is a vector the same
length as X and Y, the values in C are linearly mapped to the colors
in the current colormap. When C is a 1-by-3 matrix, it specifies the
colors of the markers as RGB values. If you have 3 points in the
scatter plot and wish to have the colors be indices into the colormap,
C should be a 3-by-1 matrix. C can also be a color string (see
ColorSpec for a list of color string specifiers)."

Subject: ploting xyz rgb

From: nman2084

Date: 11 Jun, 2011 14:44:05

Message: 7 of 7

file=fullfile(pn,fn);
dat = load(file);
x = dat(:,1);
y = dat(:,2);
z = dat(:,3);
r = dat(:,4)/255;
g = dat(:,5)/255;
b = dat(:,6)/255;

repmat(c,[r,g,b]);
scatter3(x,y,z,5,c,'filled');


I am not getting anything in plot all white.

Also if i have 1 million points (x,y,z) can Matlab handle it.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us