read_captcha: Read captcha files

View source: R/read.R

read_captchaR Documentation

Read captcha files

Description

Given the paths to one or more files, reads and converts them into a captcha list that can be used for modeling or prediction. If lab_in_path=TRUE, will take the label for the Captchas from their filenames using ⁠_⁠ as the separator.

Usage

read_captcha(files, lab_in_path = FALSE)

Arguments

files

Paths to one or more captcha images

lab_in_path

Whether or not the labels to the captchas are already in the paths to the files (separated by and underscore in the filename)

Details

The read_captcha() function reads a character vector of image files and stores them in memory. Behind the scenes, the function uses the {magick} package to deal with the types of files that may appear (JPEG, PNG, among others).

Value

A list of class captcha. The captcha object is a list with three elements: ⁠$img⁠, which contains the image read from the {magick} package; ⁠$lab⁠, which contains the image label (by default, NULL); and ⁠$path⁠, which contains the path of the image.

Examples


captcha_file <- system.file("examples/captcha/esaj.png", package = "captcha")
cap <- read_captcha(captcha_file)
cap


decryptr/captcha documentation built on April 15, 2023, 12:42 a.m.