MATLAB Answers

Plot 2D images in 3D scatter plot

117 views (last 30 days)
Gregor on 25 Oct 2018
Commented: ACHAMMA JACOB on 30 Jan 2019
I recorded someone moving in front of a camera and now I have a 3D scatter plot of points that track that person's eyes (red and green in the picture below) over x, y and time. I want to insert single frames at specific time locations to show the current status of the input frame. How do I insert (transparent) 2D images into 3D plots?
Now I know how to create surfaces of images, and I also tried playing with hgtransform. However I'm not able to place both scatter3 and image in the same plot. They always end up on separate axes. I think those 2 links are related:
Thanks for your help


Sign in to comment.

Accepted Answer

Oliver Woodford
Oliver Woodford on 26 Oct 2018
h = surface(X, Y, Z, im, 'facecolor', 'texturemap', 'edgecolor', 'none');
alpha(h, 0.5);
X, Y, and Z are each 2x2 matrices containing the x, y and z coordinates of the 4 corners of your image, im.


Show 2 older comments
Gregor on 30 Oct 2018
voilà my new figure!
I have one more question: Is there a way to make the screenshots partially transparent? Ideally all white pixels will be transparent. Normally I would use AlphaData, but it has to have the same size as ZData, which in my case is a 2x2 matrix corresponding to the corners. I tried converting CData to a double matrix and setting white pixel values to NaN, however that only resulted in a black background, as NaN is interpreted as 0. Thanks for any ideas
Oliver Woodford
Oliver Woodford on 9 Dec 2018
The vol3d method can do what you want, so it is possible. The relevant lines are:
opts = {'cdatamapping',[],'alphadatamapping',[],'facecolor','texturemap','edgealpha',0,'facealpha','texturemap'};
From that code it doesn't look like AlphaData does need to be 2x2.
ACHAMMA JACOB on 30 Jan 2019
how to convert a jpg binarized image into scatter plot if we doesnot have the data points?

Sign in to comment.

More Answers (0)