我有100多个图像的文件夹。我想在同一时间,我想创建将由一个访问每个图像之一,并运行分析功能运行的一个图像的分析,而不是运行R.他们每个人的谷歌视觉分析。
使用下面的代码:
getGooglevisionResponse(file.choose(),feature = 'text_detection')
我使用file.choose()
选择一次一个文件,但我想创建一个循环,这将动态地选择每个图像和对它们运行分析..二手list.files()
但得到以下错误the following condition has length >1 and only the first element will be used
找到一个职位,但也就是在Python无法复制它R中
在没有看到更多的代码,你只需要使用lapply
和list.files
。
fil <- list.files("<myImgDir>", full.names = T)
out <- lapply(fil, getGoogleVisionResponse, feature = 'text_detection'))