【发布时间】:2022-08-19 18:11:12
【问题描述】:
我有大量图像,我想绘制每个图像熵的密度图。然后我想将单个图像叠加在密度图的顶部,有人对什么是最好的包或程序有什么建议吗?我通常使用 Python-3 和 R,但如果更容易/更好,我会考虑其他的。
标签: r python-3.x visualization data-analysis probability-density
我有大量图像,我想绘制每个图像熵的密度图。然后我想将单个图像叠加在密度图的顶部,有人对什么是最好的包或程序有什么建议吗?我通常使用 Python-3 和 R,但如果更容易/更好,我会考虑其他的。
标签: r python-3.x visualization data-analysis probability-density
这是使用函数sinkr::addImg() 的R 选项。您可以通过指定图像中心的 x 和 y 坐标以及所需的宽度(以 x 轴为单位)来将图像添加到现有绘图中:
library(sinkr) # https://github.com/marchtaylor/sinkr
library(png)
myurl <- paste0("https://upload.wikimedia.org/wikipedia/commons/thumb/",
"e/e1/Jupiter_%28transparent%29.png/242px-Jupiter_%28transparent%29.png")
z <- tempfile()
download.file(myurl,z,mode="wb")
pic <- readPNG(z)
file.remove(z) # cleanup
dim(pic)
image(volcano)
addImg(pic, x = 0.3, y = 0.5, width = 0.4)
addImg(pic, x = 0.4, y = 0.6, width = 0.1)
【讨论】: