R 获取图像的一个点的坐标

R 获取图像的一个点的坐标,r,image,coordinates,R,Image,Coordinates,让我们用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 &l

让我们用
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!
库(成像仪)

文件我找到了一个非常简单的解决方案:运行
locator()
您可以单击绘图中的任何位置,然后在缩放后,我们可以获得R壳中的XY坐标