face_emotion() 的 indicoio 包给出 "Couldn't connect to host" 错误
face_emotion() of indicoio package giving "Couldn't connect to host" error
首先我使用
读取图像
img<-readPNG(imageLocation)
imageLocation是图片位置的路径path.expand()
imageLocation = path.expand("~/R/funwithR/data/mero_photoforanalysis.png")
转换为灰度由
完成
img <- 0.2126 * img[, , 1] + 0.7152 * img[, , 2] + 0.0722 * img[, , 3]
最终错误由
给出
face_emotion(img)
错误是
Error in function (type, msg, asError = TRUE) : couldn't connect to host
我认为这里的问题在于您传递给 indico 的格式 API。如 indico docs 所示,API 接受文件路径作为输入。不是图像对象。
有利的一面是,您无需转换为灰度。如果您简单 运行 以下代码,它应该可以工作:
fer(path.expand("~/R/funwithR/data/mero_photoforanalysis.png"))
首先我使用
读取图像img<-readPNG(imageLocation)
imageLocation是图片位置的路径path.expand()
imageLocation = path.expand("~/R/funwithR/data/mero_photoforanalysis.png")
转换为灰度由
完成img <- 0.2126 * img[, , 1] + 0.7152 * img[, , 2] + 0.0722 * img[, , 3]
最终错误由
给出face_emotion(img)
错误是
Error in function (type, msg, asError = TRUE) : couldn't connect to host
我认为这里的问题在于您传递给 indico 的格式 API。如 indico docs 所示,API 接受文件路径作为输入。不是图像对象。
有利的一面是,您无需转换为灰度。如果您简单 运行 以下代码,它应该可以工作:
fer(path.expand("~/R/funwithR/data/mero_photoforanalysis.png"))