r - 获取在 R 中用成像器加载的图片点的坐标
问题描述
让我们用imager
.
library(imager)
file <- system.file('extdata/parrots.png',package='imager')
#system.file gives the full path for a file that ships with a R package
#if you already have the full path to the file you want to load just run:
#im <- load.image("/somedirectory/myfile.png")
im <- load.image(file)
plot(im) #Parrots!
我想得到这张图片中两点的坐标:眼睛,如下图:
如何获得两个点的 XY 坐标的数值?
解决方案
我找到了一个非常简单的解决方案:运行locator()
你可以在图中的任意位置单击,在 Scaping 之后,我们得到 R shell 中的 XY 坐标。
推荐阅读
- magento - Magento 2 - 可配置的产品价格
- ansible - 如何获取 Ansible playbook 中使用的变量列表?
- vue.js - 无法从对象列表Vuejs生成数据
- node.js - 卡在 mongoDB 中让 $lookup
- xamarin.android - َAndroid:右键单击鼠标左键打开上下文菜单并且不关闭
- typescript - 在运行时区分泛型类型的可能性的最佳方法是什么?
- javascript - 安装反应应用程序时出现问题
- python - 为什么我的损失函数总是返回 nan?
- java - 由于某种原因,我无法访问从另一个类派生的类的方法
- sql - 将空字符串从 Excel 插入 SQL(int)