Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw Marker in Image

I'm drawing a picture using Matplotlib:

plt.imshow(bild)
plt.show()

How do I add a Marker to this (eg. red dot / arrow) using the coordinates of the image?

like image 311
Stein Avatar asked Sep 13 '15 15:09

Stein


People also ask

How do I add a marker to an image in Matlab?

Draw Markers on an Image Insert a plus (+) marker. RGB = insertMarker(I,[147 279]);


1 Answers

You can also use plt.scatter to add a red dot to mark the point. Building on the previous answer's example code:

import matplotlib.pyplot as plt
import numpy as np

img = np.random.randn(100, 100)

plt.figure()
plt.imshow(img)
plt.annotate('25, 50', xy=(25, 50), xycoords='data',
             xytext=(0.5, 0.5), textcoords='figure fraction',
             arrowprops=dict(arrowstyle="->"))
plt.scatter(25, 50, s=500, c='red', marker='o')
plt.show()
like image 164
George Liu Avatar answered Oct 10 '22 18:10

George Liu