shinyで画像を読み込み、表示するところまではできるのですが、その後その画像の輝度値を求める方法が分からずに困っています。
【UI】
library(shiny)
ui<-shinyUI(
tabPanel("Image", fluidPage(
titlePanel("Image"),
fluidRow(
column(2,
fileInput("file1", "Choose image File",
multiple = TRUE,
accept = c(".png","bmp","jpeg","jpg"))
),
column(10,
mainPanel(
tabsetPanel(
type="tabs",
tabPanel("image",
imageOutput("image")
), #close tabpanel
tabPanel("brightness",
tableOutput("brightness")
) #close tabpanel
)
)#clsoe mainPanle
)#close column10
)#close fluidrow
)#close fluidpage
)#lsoe tabpanel
)#close shiny"
【Server】
library(shiny)
library(imager)
shinyServer(function(input, output) {
output$image <- renderImage({
req(input$file1)
return(list(
src = input$file1$datapath,
contentType = ".png",
width = 300,
height = 300
))
}) #close renderImage
output$brightness <- renderPrint({
req(input$file1)
grayimage=grayscale(src = input$file1$datapath) #ここの書き方がよく分かりません。
brightness1 <- c(grayimage[,,1,1])
print(grayimage[,,1,1])
})
})
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/03 07:24