在图像中绘制标记 [英] Draw Marker in Image

查看:35
本文介绍了在图像中绘制标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Matplotlib绘制图片:

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?

推荐答案

您还可以使用

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()

这篇关于在图像中绘制标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆