Constructs a regression dataset whose residual plot reveals a hidden image. Based on the method by Staudenmayer & Stefanski. The image is converted to a binary (black/white) scatter of points, then embedded into the structure of a linear regression.

stego_lm_hide(path, size = 100, cutoff = 0.5, coef.det = 0.05, p = 5, M = 100)

Arguments

path

path to an image file (png/jpg/bmp), or a cimg object

size

resize the image to this width/height in pixels before converting to binary. Smaller values run faster. Default 100.

cutoff

threshold for binarisation (0-1). Pixels darker than this become scatter points. Default 0.5.

coef.det

target R-squared of the fake regression. Default 0.05.

p

number of predictor columns in the output data frame. Default 5.

M

number of border points per edge for orthogonalisation. Default 100.

Value

A data.frame with columns Y, X1, ..., Xp. Fitting lm(Y ~ ., data = result) and plotting fitted vs residuals reveals the hidden image.

Examples

if (FALSE) { # \dontrun{
dat <- stego_lm_hide("photo.png")
stego_lm_reveal(dat)
} # }