SegmentCV: Chan-Vese segmentation

Description Usage Arguments Value Author(s) References Examples

View source: R/chan_vese_segmentation.R

Description

iterative image segmentation with Chan-Vese model

Usage

1
2
SegmentCV(im, mu = 0.25, nu = 0, lambda1 = 1, lambda2 = 1,
  tol = 1e-04, maxiter = 500, dt = 0.5, initial, returnstep)

Arguments

im

a grayscale image of class cimg

mu

length penalty

nu

area penalty

lambda1

fit weight inside the cuve

lambda2

fit weight outside the curve

tol

convergence tolerance

maxiter

maximum number of iterations

dt

time step

initial

"interactive" or a grayscale image of class cimg. you can define initial condition as a rectangle shape interactively if initial is "interactive". If initial is a grayscale image of class cimg, pixels whose values are negative will be treated as outside of contour. pixels whose values are non-negative will be treated as inside of contour. checker board condition will be used if initial is not specified.

returnstep

a numeric vector that determines which result will be returned. 0 means initial condition, and 1 means the result after 1 iteration. final result will be returned if returnstep is not specified.

Value

a pixel set or a list of lists of numeric and pixel set

Author(s)

Shota Ochi

References

Pascal Getreuer (2012). Chan-Vese Segmentation. Image Processing On Line 2, 214-224.

Examples

1
2
3
4
layout(matrix(1:2, 1, 2))
g <- grayscale(dogs)
plot(g, main = "Original")
SegmentCV(g, lambda2 = 15) %>% plot(main = "Binarized")

Example output

Loading required package: imager
Loading required package: magrittr

Attaching package:imagerThe following object is masked frompackage:magrittr:

    add

The following objects are masked frompackage:stats:

    convolve, spectrum

The following object is masked frompackage:graphics:

    frame

The following object is masked frompackage:base:

    save.image

The computation stopped because the number of iteration reached maxiter.

imagerExtra documentation built on May 2, 2019, 1:44 p.m.