imageToPatch {MBCbook}R Documentation

Transform an image into a collection of patches

Description

Transform an image into a collection of small images (patches) that cover the original image.

Usage

imageToPatch(Im,f)

Arguments

Im

the image for which one wants to extract local patches.

f

the size of the desired patches (fxf).

Value

A data frame of all extracted patches is returned.

Author(s)

C. Bouveyron & J. Delon

Examples

Im = diag(16) 
ImNoise = Im + rnorm(256,0,0.1)
X = imageToPatch(ImNoise,4)
out = mixmodCluster(X,10,model=mixmodGaussianModel(family=c("spherical")))
res = mixmodPredict(X,out@bestResult)
Xdenoised = denoisePatches(X,out,P = res@proba,sigma = 0.1) 
ImRec = reconstructImage(Xdenoised,16,16)
oldpar <- par(no.readonly = TRUE)
par(mfrow=c(1,3))
imshow(Im); imshow(ImNoise); imshow(ImRec)
par(oldpar)

[Package MBCbook version 0.1.2 Index]