Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add an image thumbnail as(or beside) a plot marker in MATLAB?

I am running Isomap Dimensionality reduction in MATLAB on a series of images. I want to plot the image's thumbnail beside the point on the manifold corresponding to it.

Examples of manifolds

I am currently using 2 differnt isomaps http://isomap.stanford.edu/ and http://robotics.cs.brown.edu/projects/stisomap/ .

like image 623
web_ninja Avatar asked Oct 21 '22 09:10

web_ninja


1 Answers

The imagesc function can take arguments which dictate where the image is drawn, so I would use this. Here's an example of imagesc being drawn on top of a plot:

% Draw plot
vals=rand(2,100);
plot(vals(1,:),vals(2,:),'x');
hold on;

% Draw image
im=imread('moon.tif');
xs=linspace(0.1, 0.2, size(im, 2) );
ys=linspace(0.1, 0.2, size(im, 1) );
colormap gray;
imagesc(xs,ys,im)

Which looks like this:

Note the first two arguments to imagesc which define the range over which the image is drawn. Obviously you'll want to change the arguments to linspace, which will define the position and size of the image, and you'll need to take account for the aspect ratio if the image isn't square, but hopefully this will get you along the right lines.

like image 194
devrobf Avatar answered Oct 31 '22 21:10

devrobf