ibezito
ibezito

Reputation: 5822

Drawing an arrow on top of an image - MATLAB

I'm trying to draw an arrow on top of an image in MATLAB, between two pixels: [x0,y0] and [x1,y1].

I tried to use annotation function. The problem is that the function takes as an input x,y values which represent coordinates on the figure, instead of on the image itself.

Does anyone knows how can I draw an arrow between two pixels in an image?

Example

 imshow(imread('peppers.png'));hold on;

I would like to generate a blue arrow from pixel (1,1) to pixel(200,200), so it should look something like this (only in blue instead of black):

enter image description here

Thanks!

Upvotes: 2

Views: 2581

Answers (1)

bushmills
bushmills

Reputation: 673

you could simply use the quiver-function:

figure;
imshow(imread('peppers.png'));hold on;
quiver(0,0,200,200,0)

enter image description here

Upvotes: 4

Related Questions