Type: Package
Title: Create Array Data from 2D Image Thumbnails via Google Image Search
Version: 0.99.2
Date: 2021-09-28
Depends: R (≥ 4.1.0)
Imports: xml2, rvest, EBImage, magrittr
Suggests: testthat
Description: Images are provided as an array dataset of 2D image thumbnails from Google Image Search https://www.google.com/search. This array data may be suitable for a training data of machine learning or deep learning as a first trial.
License: Artistic-2.0
URL: https://github.com/kumeS/GoogleImage2Array
RoxygenNote: 7.1.2
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2021-09-28 15:27:14 UTC; skume
Author: Satoshi Kume [aut, cre]
Maintainer: Satoshi Kume <satoshi.kume.1984@gmail.com>
Repository: CRAN
Date/Publication: 2021-09-29 08:20:16 UTC

GoogleImage2array: create array from image thumbnails.

Description

This function is to create the R array/tensor from 2D image obtained from Google image search. This function provides an array consisted of 20 images per run.

Usage

GoogleImage2array(
  Query,
  wh = 64,
  Col = TRUE,
  Save = FALSE,
  file_path = NULL,
  gl = "us"
)

Arguments

Query

a character vector to search images

wh

a value of pixels in height and width.

Col

a logical. Whether to handle color or gray images. if TRUE, use color mode.

Save

a logical. Whether to save images locally or not. if TRUE, save locally.

file_path

a character. a directory to save the image file.

gl

a character to show a region information. ex. us, ja etc

Value

array

Author(s)

Satoshi Kume

Examples


library(EBImage)

# Simple examples
query <- "persian cat"
CatImg <- GoogleImage2array(query)

#show info
str(CatImg)

query <- "Shiba inu"
DogImg <- GoogleImage2array(query)

#show info
str(DogImg)

#Bind arrays
ImgDat <- EBImage::abind(CatImg$array, DogImg$array, along=1)

#show info
str(ImgDat)




display.array: display 4d array as a tiled image.

Description

This function is to create the R array/tensor from 2D image obtained from Google image search.

Usage

display.array(x, Save = FALSE, file_path = NULL)

Arguments

x

a list obtained by the GoogleImage2array function.

Save

a logical. Whether to save images locally or not. if TRUE, save locally.

file_path

a character. a directory to save the image file.

Value

image

Author(s)

Satoshi Kume

Examples


library(EBImage)

# Simple examples
query <- "persian cat"
CatImg <- GoogleImage2array(query)

#show images
display.array(CatImg)

query <- "Shiba inu"
DogImg <- GoogleImage2array(query)

#show images
display.array(DogImg)