eptdecomp2d: Decomposition of an Image by Two-dimensional Ensemble Patch...

Description Usage Arguments Details Value See Also Examples

View source: R/EPT2d.R

Description

This function decomposes an image into frequency component and residue of two-dimensional ensemble patch transform by sifting process.

Usage

1
2
3
4
eptdecomp2d(x = NULL, y = NULL, z, type = "rectangle", tau, theta = 0, 
    process = c("average", "average"), pquantile = c(0, 1), equantile = c(0, 1), 
    gamma = 1, boundary = "reflexive", 
    stoprule = "type2", tol = 0.1^2, maxiter = 10, check = FALSE) 

Arguments

x, y

locations of regular grid at which the values in image z are measured. When it is NULL, the image is supposed to be equally spaced.

z

matrix of an image observed at location (x, y).

type

patch type of "rectangle" or "oval".

tau

a size parameter for two-dimensional ensemble patch transform: tau[1] for horizontal size and tau[2] for vertical size of a two-dimensional patch. When length(tau) is 1, the horizontal and vertical size are the same.

theta

a degree of clockwise rotation of a patch.

process

specifies transform types for patch and ensemble processes: process[1] for patch process and process[2] for ensemble process. Each process has options of "average", "median", or "envelope". Note that when process[1] is "average" or "median", process[2] must be "average" or "median". When process[1] is "envelope", lower and upper envelopes are obtained by \code{pquantile[1]} \times 100 \%-quantile and \code{pquantile[2]} \times 100 \%-quantile of patches, respectively. When process[2] is "envelope", ensemble lower and upper envelopes are obtained as \code{equantile[1]} \times 100 \%-quantile and \code{equantile[2]} \times 100 \%-quantile of lower and upper envelopes of shifted patches, respectively.

pquantile

quantiles for lower and upper envelopes of patch transform. When it is c(0, 1), minimum and maximum of a patch are used for lower and upper envelopes, respectively.

equantile

quantiles for lower and upper envelopes of ensemble patch transform.

gamma

controls the amount of envelope magnitude.

boundary

specifies boundary condition from "reflexive", "periodic" or "none".

stoprule

stopping rule of sifting. The type1 stopping rule indicates that absolute values of ept (ensemble patch transform) component must be less than the user-specified tolerance level. The type2 is the stopping rule that the difference between ept components at the current and previous iterative steps must be less than the user-specified tolerance level.

tol

tolerance for stopping rule of sifting.

maxiter

the maximum number of sifting.

check

specifies whether the sifting process is displayed. When check = TRUE, ept component and residue for each sifting step are displayed. If check=TRUE, click the plotting area to start the next step.

Details

This function decomposes an image into frequency component and residue of two-dimensional ensemble patch transform by sifting process for a size parameter.

Value

eptcomp

list of ept (ensemble patch transform) component at each sifting step when check=TRUE.

FC

frequency component of ensemble patch transform by sifting process.

residue

residue of ensemble patch transform by sifting process.

parameters

a list of input parameters of type, tau, theta, process, pquantile, equantile, gamma, boundary, and output parameter niter, the number of sifting.

See Also

eptransf2d, meptransf2d.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#### example : composite of two components having different frequencies
nr <- nc <- 128; x <- seq(0, 1, length=nr); y <- seq(0, 1, length=nc)

coscomp1 <- outer(cos(20 * pi * x), cos(20 * pi * y))
coscomp2 <- outer(cos(5* pi * x), cos(5 * pi * y))
cosmeanf <- coscomp1 + coscomp2

op <- par(mfcol=c(3,1), mar=c(0,0.5,2,0.5))
image(cosmeanf, xlab="", ylab="", col=gray(0:100/100), axes=FALSE, main="a composite image")
image(coscomp1, xlab="", ylab="", col=gray(0:100/100), axes=FALSE, main="high-frequency component")
image(coscomp2, xlab="", ylab="", col=gray(0:100/100), axes=FALSE, main="low-frequency component")


#### Decomposition by Ensemble Patch Transform  
outcossift <- eptdecomp2d(z=cosmeanf, tau=8)

#### Decomposition Result
op <- par(mfrow=c(2,2), mar=c(2,2,2,1))
image(outcossift$FC, xlab="", ylab="", col=gray(0:100/100), axes=FALSE, main="Decomposed HF")
persp(outcossift$FC, theta = -30, phi = 45, col = "white", xlab="X", ylab="Y", main="Decomposed HF")
image(outcossift$residue, xlab="", ylab="", col=gray(0:100/100), axes=FALSE, main="Residue")
persp(outcossift$residue, theta = -30, phi = 45, col = "white", xlab="X", ylab="Y", main="Residue")

par(op)

EPT documentation built on Jan. 5, 2022, 9:06 a.m.

Related to eptdecomp2d in EPT...