How do I save the XY coordinates of a Binary Image in R?

喜欢而已 提交于 2019-12-07 22:41:07

问题


I am trying to save the XY coordinates of a binary image in R similarly to the save "Save XY Coordinates" function in ImageJ. I've looked through several image analysis packages available for R, but haven't yet figured out how to accomplish this.


回答1:


There are many ways to do the following in R:

img_fil <- "~/data/ZjYqw.jpg"
img <- magick::image_read(img_fil)
img_df <- RSAGA::grid.to.xyz(as.matrix(as.raster(img)))

head(img_df)
##   x   y       z
## 1 0 599 #ffffff
## 2 1 599 #ffffff
## 3 2 599 #ffffff
## 4 3 599 #ffffff
## 5 4 599 #ffffff
## 6 5 599 #ffffff


来源:https://stackoverflow.com/questions/39562605/how-do-i-save-the-xy-coordinates-of-a-binary-image-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!