【问题标题】:Overlay PNG/JPG RGB images on density plot of image entropy在图像熵的密度图上叠加 PNG/JPG RGB 图像
【发布时间】:2022-08-19 18:11:12
【问题描述】:

我有大量图像,我想绘制每个图像熵的密度图。然后我想将单个图像叠加在密度图的顶部,有人对什么是最好的包或程序有什么建议吗?我通常使用 Python-3 和 R,但如果更容易/更好,我会考虑其他的。

    标签: r python-3.x visualization data-analysis probability-density


    【解决方案1】:

    这是使用函数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)
    

    【讨论】:

      猜你喜欢
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 2011-09-15
      • 2018-02-14
      • 2018-01-04
      • 2014-05-21
      • 2019-02-28
      • 1970-01-01
      相关资源
      最近更新 更多