BayesBD.binary: Bayesian boundary detection for binary images In xylimeng/BayesBD: Bayesian Boundary Detection in Images

Usage

 `1` ```BayesBD.binary(obs, ini.mean = 0.4, n.run = 10000, n.burn = 1000, J = 10) ```

Arguments

 `obs` The noisy observation, which is a list with the following required elements: `intensity -` observed intensity at each pixel. `theta.obs, r.obs -` the location at which the intensity is observed, recorded using the polar coordinate. `center - ` the reference point that (`theta.obs, r.obs`) is referred to, defaulted as `(0.5, 0.5)`. `x, y - ` the `(x, y)` coordinates of the location. `ini.mean` a constant to specify the initial mean functions in the Bayesian estimation, defaulted as 0.4. `n.run` number of MCMC iterations. `n.burn` number of burn-in in the MCMC sampler. `J` truncation number of the Gaussian process kernel. The number of eigenfunctions is 2J + 1.

Value

Posterior samples of all parameters.

References

Li, M. and Ghosal, S.(2015) "Bayesian Detection of Image Boundaries." arXiv preprint arXiv:1508.05847.

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 25 26 27 28 29 30 31 32``` ```set.seed(2015) # ellipse boundary gamma.fun = ellipse(a = 0.35, b = 0.25) obs = par2obs(m = 100, pi.in = 0.5, pi.out = 0.2, design = 'J', gamma.fun) ## Not run: # it takes around 7min if runs 10000 iterations: saved in 'data.Rdata' BayesEst = BayesBD.binary(obs, n.run = 10000, n.burn = 1000) ## End(Not run) data(data) # visualize the estimates theta.plot = seq(from = 0, to = 2*pi, length.out = 200) gamma.hat.theta = BayesEst\$gamma.hat(theta.plot) ## plotting utilities require(plotrix) my.radial <- function(r, theta, ...){ radial.plot(c(r[order(theta)]), c(theta[order(theta)]), rp.type = "p", show.grid.label = TRUE, radial.lim = c(0, 0.5), ...) } # rotate a matrix rotate <- function(x) t(apply(x, 2, rev)) # rotate closewise by 90 degrees par(mfrow = c(1, 2)) # rotate & image it - square (asp = 1) image(rotate(obs\$intensity), axes = FALSE, asp = 1, main = 'observation') my.radial(gamma.fun(theta.plot), theta.plot, line.col = 1, lty = 2, lwd = 2, main = 'Estimated boundary vs. True', show.grid = FALSE) my.radial(gamma.hat.theta, theta.plot, add = TRUE, line.col = 'red', lty = 2, lwd = 2, show.grid = FALSE) ```

xylimeng/BayesBD documentation built on May 28, 2017, 8:34 a.m.