在给定图像坐标的图像上绘制项目符号/圆圈

时间:2019-09-29 07:33:52

标签: shiny shinydashboard shinyjs shiny-reactivity shinyapps

嗨,我有一个R闪亮的应用程序显示图像。我想根据图像坐标在图像上绘制项目符号/圆圈。正在从一个数据帧读取图像坐标,在该数据帧中,我要遍历每一行,绘制然后删除每次迭代绘制的坐标。

我现在有这样的东西

#UI
UI <- function(id) {
fluidPage(
useShinyjs(),

fluidRow(
  column(width=12,
         box(title='Select', width = NULL, closable = TRUE,
                 actionButton("draw", "draw"))
  )),

fluidRow(width=7,
         align="center",
         box(title='Draw', width=7, height = NULL,
             imageOutput("sample")
             )
         )
  )
}
#server
Server <-function(input, output, session) {
 useShinyjs()

#loop to iterate over every x,y coordinate value in data frame
 for(i in 1:nrow(data))
{
    x = data[i,1]
    y = data[i,2]
    #how do I draw these coordinates values on the below displayed image and clear 
    #the drawn figures every iteration something like addCircles() and clearShapes() in 
    #leafletProxy() used for drawing figures on maps
}
 observeEvent(input$draw, {
 output$sample<--renderImage({
 list(src = "www/data/test.png",
      contentType = 'image/png',
      width = 700,
      height = 400)
  }, deleteFile = FALSE
  )
 }

注意:我的原始图像是1920x1080,并且图像坐标符合这些尺寸,我想在应用中以自定义的宽度和高度显示图像,就像我的上方(700x400)。

0 个答案:

没有答案