0

I know this has been asked before, but I couldn't apply it.

I'm applying homography on an image, and for the report, i need to show which points I did chose (plotting dots), and I need to show also the corresponding square on the proccesed image.

One of the images I used is

http://puu.sh/cmsL1/02c1ef6e64.jpg

The points I need to plot as dot are

 X           Y

 95.0000   109.0000
 80.0000   297.0000
385.0000   274.0000
383.0000   224.0000

and the points I need to plot in the image below as a square are

http://puu.sh/cmsQb/45349305cd.jpg

 Xp   Yp

 90   133
 90   198
391   198
391   133

Hope you can help me!

I tried

p=[3,4]
plot(p(1),p(2),'Marker','p','Color',[.88 .48 0],'MarkerSize',20);

But I really don't understand the code. It plots dots on a white image. Later I tried

hold figure
imshow(im) plot(p(1),p(2),'Marker','p','Color',[.88 .48 0],'MarkerSize',20);
hold on

but it didn't work.

Jias
  • 164
  • 12
Ignacio
  • 1
  • 3
  • @Jias I first tried plotting any point, for example p=[3,4] and the I used plot(p(1),p(2),'Marker','p','Color',[.88 .48 0],'MarkerSize',20); but I really don't understand the code. It plots dots on a white image, and later i tried used hold figure, imshow(im) plot(p(1),p(2),'Marker','p','Color',[.88 .48 0],'MarkerSize',20); hold on but it didn't worked – Ignacio Oct 22 '14 at 20:18
  • Please share the code you've tried. Put it in the question, not a comment. Also, please read http://stackoverflow.com/help/how-to-ask first – Parker Oct 22 '14 at 20:22
  • Try reading [this](http://blogs.mathworks.com/steve/2007/01/01/superimposing-line-plots/). – Jias Oct 22 '14 at 20:27
  • Possible duplicate: http://stackoverflow.com/questions/3178336/matlab-how-to-plot-x-y-on-an-image-and-save – Parker Oct 22 '14 at 20:31

1 Answers1

0

To plot the points over your image do:

hold on
scatter(X, Y)

You can add properties as well, like if you wanted red circles you could do

scatter(X, Y, 'ro')

The hold on part is important so that it will do the scatterplot over the previous plot you have, which should be your image.

As for the square, the same applies, plot your image, do hold on and use the line command like so

hold on
line([Xp],[Yp])

where xp and yp are row vectors containing all the points in x and y respectively that you want to draw lines between. Remember to add a line at the end connecting the last point to the first.

schlow
  • 155
  • 1
  • 2
  • 11