0
我想創建一個閃亮的儀表板應用程序來使用EBImage進行圖像分析。我的疑問是如何使用EBImage包將本地圖像加載到應用程序中進行後驗分析。如何使用EBImage將本地圖像加載到閃亮的應用程序進行圖像分析
在網上我看到如何加載從EBImage封裝的系統文件相似圖片例如:
library(shiny)
library(EBImage)
library(displayWidget)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Display widget demo"),
# Sidebar with a select input for the image
sidebarLayout(
sidebarPanel(
selectInput("image", "Sample image:", list.files(system.file("images", package="EBImage")))
),
# Show a plot of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Static display", plotOutput("display")),
tabPanel("Interactive widget", displayWidgetOutput("widget"))
)
)
)
)
server <- function(input, output) {
img <- reactive({
f = system.file("images", input$image, package="EBImage")
x = readImage(f)
})
output$widget <- renderDisplayWidget({
displayWidget(img())
})
output$display <- renderPlot({
display(img(), method="raster", all=TRUE)
})
}
# Run the application
shinyApp(ui = ui, server = server)
我知道如何使用這個加載本地數據:
DataXLSX <- reactive({
inFile <- input$fileXLSX
if (is.null(inFile))
return(NULL)
loadXLSX <- read.xlsx(inFile$datapath)
loadXLSX
})
但我不能做與readImage()一樣。一些幫助?感謝
非常感謝!昨晚我可以加載本地圖像,但沒有req()函數。再次感謝 – Archymedes