GoogleImage2Array 0.99.7
Last modified: 2021-12-03 22:14:52
Compiled: Fri Dec 3 22:15:49 2021
library(GoogleImage2Array)
GoogleImage2array
function provide a 4-dimensional array of images via google image search.
#Search by persian cat
query <- "persian cat"
CatImg <- GoogleImage2array(query)
#show info
str(CatImg)
## List of 2
## $ array: num [1:20, 1:64, 1:64, 1:3] 0.0141 0.7029 0.1216 0.7608 0.3398 ...
## $ query: chr "persian cat"
Multi-byte characters (e.g. Japanese) can also be used.
#Search by ペルシャ猫
query <- "ペルシャ猫"
CatImgJpn <- GoogleImage2array(query)
#show info
str(CatImgJpn)
## List of 2
## $ array: num [1:20, 1:64, 1:64, 1:3] 0.789 0.264 0.144 0.481 1 ...
## $ query: chr "ペルシャ猫"
display.array
show a result as a tiled image.
#display CatImg
display.array(CatImg)
Display = TRUE
option)The images are displayed in tiles by the option of GoogleImage2array function.
#Search by Shiba inu (One line execution)
DogImg <- GoogleImage2array("Shiba inu", Display = TRUE)
#show info
str(DogImg)
## List of 2
## $ array: num [1:20, 1:64, 1:64, 1:3] 0.895 0.996 0.814 0.603 0.687 ...
## $ query: chr "Shiba inu"
GoogleImage2array.world
functionThis function retrieves images from 10 regions of the world and returns them as a single array data.
This allows more than 20 images to be acquired at a time.
query <- "Shiba inu"
DogImgw <- GoogleImage2array.world(query)
str(DogImgw)
## List of 2
## $ array: num [1:112, 1:64, 1:64, 1:3] 0.514 0.18 0.895 0.167 0.181 ...
## $ query: chr [1:10] "Shiba inu" "Shiba inu" "Shiba inu" "Shiba inu" ...
#Bind two arrays to one array
ImgDat <- bind.array(CatImg, DogImg)
#show info
str(ImgDat)
## List of 2
## $ array: num [1:40, 1:64, 1:64, 1:3] 0.0141 0.7029 0.1216 0.7608 0.3398 ...
## $ query: chr [1:2] "persian cat" "Shiba inu"
#show images
display.spiral(CatImg)
## R version 4.1.2 (2021-11-01)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
##
## locale:
## [1] ja_JP.UTF-8/ja_JP.UTF-8/ja_JP.UTF-8/C/ja_JP.UTF-8/ja_JP.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] EBImage_4.36.0 GoogleImage2Array_0.99.7 BiocStyle_2.22.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.7 highr_0.9 compiler_4.1.2
## [4] BiocManager_1.30.16 jquerylib_0.1.4 rTensor_1.4.8
## [7] bitops_1.0-7 tools_4.1.2 digest_0.6.29
## [10] lubridate_1.8.0 evaluate_0.14 lifecycle_1.0.1
## [13] lattice_0.20-45 png_0.1-7 rlang_0.4.12
## [16] magick_2.7.3 curl_4.3.2 yaml_2.2.1
## [19] xfun_0.28 fastmap_1.1.0 stringr_1.4.0
## [22] httr_1.4.2 knitr_1.36 xml2_1.3.3
## [25] generics_0.1.1 fftwtools_0.9-11 htmlwidgets_1.5.4
## [28] GlobalOptions_0.1.2 locfit_1.5-9.4 grid_4.1.2
## [31] spiralize_1.0.3 R6_2.5.1 GetoptLong_1.0.5
## [34] jpeg_0.1-9 rmarkdown_2.11 bookdown_0.24
## [37] magrittr_2.0.1 htmltools_0.5.2 BiocGenerics_0.40.0
## [40] abind_1.4-5 rvest_1.0.2 shape_1.4.6
## [43] colorspace_2.0-2 circlize_0.4.13 tiff_0.1-10
## [46] stringi_1.7.6 RCurl_1.98-1.5 rjson_0.2.20
## [49] crayon_1.4.2