View Source Evision.HFS.HfsSegment (Evision v0.2.9)

Summary

Types

t()

Type that represents an HFS.HfsSegment struct.

Functions

Clears the algorithm state

: create a hfs object

: create a hfs object

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

getMinRegionSizeI

getMinRegionSizeII

getSegEgbThresholdI

getSegEgbThresholdII

getSlicSpixelSize

getSpatialWeight

do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.

do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.

do segmentation gpu

Reads algorithm parameters from a file storage

: set and get the parameter minRegionSizeI. This parameter is used in the second stage mentioned above. After the EGB segmentation, regions that have fewer pixels then this parameter will be merged into it's adjacent region.

: set and get the parameter minRegionSizeII. This parameter is used in the third stage mentioned above. It serves the same purpose as minRegionSizeI

: set and get the parameter numSlicIter. This parameter is used in the first stage. It describes how many iteration to perform when executing SLIC.

: set and get the parameter segEgbThresholdI. This parameter is used in the second stage mentioned above. It is a constant used to threshold weights of the edge when merging adjacent nodes when applying EGB algorithm. The segmentation result tends to have more regions remained if this value is large and vice versa.

: set and get the parameter segEgbThresholdII. This parameter is used in the third stage mentioned above. It serves the same purpose as segEgbThresholdI. The segmentation result tends to have more regions remained if this value is large and vice versa.

: set and get the parameter slicSpixelSize. This parameter is used in the first stage mentioned above(the SLIC stage). It describes the size of each superpixel when initializing SLIC. Every superpixel approximately has \f$slicSpixelSize \times slicSpixelSize\f$ pixels in the beginning.

: set and get the parameter spatialWeight. This parameter is used in the first stage mentioned above(the SLIC stage). It describes how important is the role of position when calculating the distance between each pixel and it's center. The exact formula to calculate the distance is \f$colorDistance + spatialWeight \times spatialDistance\f$. The segmentation result tends to have more local consistency if this value is larger.

Stores algorithm parameters in a file storage

Types

@type t() :: %Evision.HFS.HfsSegment{ref: reference()}

Type that represents an HFS.HfsSegment struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec clear(Keyword.t()) :: any() | {:error, String.t()}
@spec clear(t()) :: t() | {:error, String.t()}

Clears the algorithm state

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()

Python prototype (for reference only):

clear() -> None
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec create(integer(), integer()) :: t() | {:error, String.t()}

: create a hfs object

Positional Arguments
  • height: integer().

    the height of the input image

  • width: integer().

    the width of the input image

Keyword Arguments
  • segEgbThresholdI: float.

    parameter segEgbThresholdI

  • minRegionSizeI: integer().

    parameter minRegionSizeI

  • segEgbThresholdII: float.

    parameter segEgbThresholdII

  • minRegionSizeII: integer().

    parameter minRegionSizeII

  • spatialWeight: float.

    parameter spatialWeight

  • slicSpixelSize: integer().

    parameter slicSpixelSize

  • numSlicIter: integer().

    parameter numSlicIter

Return
  • retval: HfsSegment

Python prototype (for reference only):

create(height, width[, segEgbThresholdI[, minRegionSizeI[, segEgbThresholdII[, minRegionSizeII[, spatialWeight[, slicSpixelSize[, numSlicIter]]]]]]]) -> retval
Link to this function

create(height, width, opts)

View Source
@spec create(
  integer(),
  integer(),
  [
    minRegionSizeI: term(),
    minRegionSizeII: term(),
    numSlicIter: term(),
    segEgbThresholdI: term(),
    segEgbThresholdII: term(),
    slicSpixelSize: term(),
    spatialWeight: term()
  ]
  | nil
) :: t() | {:error, String.t()}

: create a hfs object

Positional Arguments
  • height: integer().

    the height of the input image

  • width: integer().

    the width of the input image

Keyword Arguments
  • segEgbThresholdI: float.

    parameter segEgbThresholdI

  • minRegionSizeI: integer().

    parameter minRegionSizeI

  • segEgbThresholdII: float.

    parameter segEgbThresholdII

  • minRegionSizeII: integer().

    parameter minRegionSizeII

  • spatialWeight: float.

    parameter spatialWeight

  • slicSpixelSize: integer().

    parameter slicSpixelSize

  • numSlicIter: integer().

    parameter numSlicIter

Return
  • retval: HfsSegment

Python prototype (for reference only):

create(height, width[, segEgbThresholdI[, minRegionSizeI[, segEgbThresholdII[, minRegionSizeII[, spatialWeight[, slicSpixelSize[, numSlicIter]]]]]]]) -> retval
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: bool

Python prototype (for reference only):

empty() -> retval
Link to this function

getDefaultName(named_args)

View Source
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}

getDefaultName

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

Python prototype (for reference only):

getDefaultName() -> retval
Link to this function

getMinRegionSizeI(named_args)

View Source
@spec getMinRegionSizeI(Keyword.t()) :: any() | {:error, String.t()}
@spec getMinRegionSizeI(t()) :: integer() | {:error, String.t()}

getMinRegionSizeI

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: integer()

Python prototype (for reference only):

getMinRegionSizeI() -> retval
Link to this function

getMinRegionSizeII(named_args)

View Source
@spec getMinRegionSizeII(Keyword.t()) :: any() | {:error, String.t()}
@spec getMinRegionSizeII(t()) :: integer() | {:error, String.t()}

getMinRegionSizeII

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: integer()

Python prototype (for reference only):

getMinRegionSizeII() -> retval
Link to this function

getNumSlicIter(named_args)

View Source
@spec getNumSlicIter(Keyword.t()) :: any() | {:error, String.t()}
@spec getNumSlicIter(t()) :: integer() | {:error, String.t()}

getNumSlicIter

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: integer()

Python prototype (for reference only):

getNumSlicIter() -> retval
Link to this function

getSegEgbThresholdI(named_args)

View Source
@spec getSegEgbThresholdI(Keyword.t()) :: any() | {:error, String.t()}
@spec getSegEgbThresholdI(t()) :: number() | {:error, String.t()}

getSegEgbThresholdI

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: float

Python prototype (for reference only):

getSegEgbThresholdI() -> retval
Link to this function

getSegEgbThresholdII(named_args)

View Source
@spec getSegEgbThresholdII(Keyword.t()) :: any() | {:error, String.t()}
@spec getSegEgbThresholdII(t()) :: number() | {:error, String.t()}

getSegEgbThresholdII

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: float

Python prototype (for reference only):

getSegEgbThresholdII() -> retval
Link to this function

getSlicSpixelSize(named_args)

View Source
@spec getSlicSpixelSize(Keyword.t()) :: any() | {:error, String.t()}
@spec getSlicSpixelSize(t()) :: integer() | {:error, String.t()}

getSlicSpixelSize

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: integer()

Python prototype (for reference only):

getSlicSpixelSize() -> retval
Link to this function

getSpatialWeight(named_args)

View Source
@spec getSpatialWeight(Keyword.t()) :: any() | {:error, String.t()}
@spec getSpatialWeight(t()) :: number() | {:error, String.t()}

getSpatialWeight

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
Return
  • retval: float

Python prototype (for reference only):

getSpatialWeight() -> retval
Link to this function

performSegmentCpu(named_args)

View Source
@spec performSegmentCpu(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

performSegmentCpu(self, src)

View Source
@spec performSegmentCpu(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}

do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.

Positional Arguments
Keyword Arguments
  • ifDraw: bool.
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

performSegmentCpu(src[, ifDraw]) -> retval
Link to this function

performSegmentCpu(self, src, opts)

View Source
@spec performSegmentCpu(t(), Evision.Mat.maybe_mat_in(), [{:ifDraw, term()}] | nil) ::
  Evision.Mat.t() | {:error, String.t()}

do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it.

Positional Arguments
Keyword Arguments
  • ifDraw: bool.
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

performSegmentCpu(src[, ifDraw]) -> retval
Link to this function

performSegmentGpu(named_args)

View Source
@spec performSegmentGpu(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

performSegmentGpu(self, src)

View Source
@spec performSegmentGpu(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}

do segmentation gpu

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()

  • src: Evision.Mat.

    the input image

Keyword Arguments
  • ifDraw: bool.

    if draw the image in the returned Mat. if this parameter is false, then the content of the returned Mat is a matrix of index, describing the region each pixel belongs to. And it's data type is CV_16U. If this parameter is true, then the returned Mat is a segmented picture, and color of each region is the average color of all pixels in that region. And it's data type is the same as the input image

Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

performSegmentGpu(src[, ifDraw]) -> retval
Link to this function

performSegmentGpu(self, src, opts)

View Source
@spec performSegmentGpu(t(), Evision.Mat.maybe_mat_in(), [{:ifDraw, term()}] | nil) ::
  Evision.Mat.t() | {:error, String.t()}

do segmentation gpu

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()

  • src: Evision.Mat.

    the input image

Keyword Arguments
  • ifDraw: bool.

    if draw the image in the returned Mat. if this parameter is false, then the content of the returned Mat is a matrix of index, describing the region each pixel belongs to. And it's data type is CV_16U. If this parameter is true, then the returned Mat is a segmented picture, and color of each region is the average color of all pixels in that region. And it's data type is the same as the input image

Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

performSegmentGpu(src[, ifDraw]) -> retval
@spec read(Keyword.t()) :: any() | {:error, String.t()}
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

Reads algorithm parameters from a file storage

Positional Arguments

Python prototype (for reference only):

read(fn) -> None
@spec save(Keyword.t()) :: any() | {:error, String.t()}
@spec save(t(), binary()) :: t() | {:error, String.t()}

save

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • filename: String

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).

Python prototype (for reference only):

save(filename) -> None
Link to this function

setMinRegionSizeI(named_args)

View Source
@spec setMinRegionSizeI(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMinRegionSizeI(self, n)

View Source
@spec setMinRegionSizeI(t(), integer()) :: t() | {:error, String.t()}

: set and get the parameter minRegionSizeI. This parameter is used in the second stage mentioned above. After the EGB segmentation, regions that have fewer pixels then this parameter will be merged into it's adjacent region.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • n: integer()

Python prototype (for reference only):

setMinRegionSizeI(n) -> None
Link to this function

setMinRegionSizeII(named_args)

View Source
@spec setMinRegionSizeII(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMinRegionSizeII(self, n)

View Source
@spec setMinRegionSizeII(t(), integer()) :: t() | {:error, String.t()}

: set and get the parameter minRegionSizeII. This parameter is used in the third stage mentioned above. It serves the same purpose as minRegionSizeI

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • n: integer()

Python prototype (for reference only):

setMinRegionSizeII(n) -> None
Link to this function

setNumSlicIter(named_args)

View Source
@spec setNumSlicIter(Keyword.t()) :: any() | {:error, String.t()}
@spec setNumSlicIter(t(), integer()) :: t() | {:error, String.t()}

: set and get the parameter numSlicIter. This parameter is used in the first stage. It describes how many iteration to perform when executing SLIC.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • n: integer()

Python prototype (for reference only):

setNumSlicIter(n) -> None
Link to this function

setSegEgbThresholdI(named_args)

View Source
@spec setSegEgbThresholdI(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setSegEgbThresholdI(self, c)

View Source
@spec setSegEgbThresholdI(t(), number()) :: t() | {:error, String.t()}

: set and get the parameter segEgbThresholdI. This parameter is used in the second stage mentioned above. It is a constant used to threshold weights of the edge when merging adjacent nodes when applying EGB algorithm. The segmentation result tends to have more regions remained if this value is large and vice versa.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • c: float

Python prototype (for reference only):

setSegEgbThresholdI(c) -> None
Link to this function

setSegEgbThresholdII(named_args)

View Source
@spec setSegEgbThresholdII(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setSegEgbThresholdII(self, c)

View Source
@spec setSegEgbThresholdII(t(), number()) :: t() | {:error, String.t()}

: set and get the parameter segEgbThresholdII. This parameter is used in the third stage mentioned above. It serves the same purpose as segEgbThresholdI. The segmentation result tends to have more regions remained if this value is large and vice versa.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • c: float

Python prototype (for reference only):

setSegEgbThresholdII(c) -> None
Link to this function

setSlicSpixelSize(named_args)

View Source
@spec setSlicSpixelSize(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setSlicSpixelSize(self, n)

View Source
@spec setSlicSpixelSize(t(), integer()) :: t() | {:error, String.t()}

: set and get the parameter slicSpixelSize. This parameter is used in the first stage mentioned above(the SLIC stage). It describes the size of each superpixel when initializing SLIC. Every superpixel approximately has \f$slicSpixelSize \times slicSpixelSize\f$ pixels in the beginning.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • n: integer()

Python prototype (for reference only):

setSlicSpixelSize(n) -> None
Link to this function

setSpatialWeight(named_args)

View Source
@spec setSpatialWeight(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setSpatialWeight(self, w)

View Source
@spec setSpatialWeight(t(), number()) :: t() | {:error, String.t()}

: set and get the parameter spatialWeight. This parameter is used in the first stage mentioned above(the SLIC stage). It describes how important is the role of position when calculating the distance between each pixel and it's center. The exact formula to calculate the distance is \f$colorDistance + spatialWeight \times spatialDistance\f$. The segmentation result tends to have more local consistency if this value is larger.

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • w: float

Python prototype (for reference only):

setSpatialWeight(w) -> None
@spec write(Keyword.t()) :: any() | {:error, String.t()}
@spec write(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

Stores algorithm parameters in a file storage

Positional Arguments

Python prototype (for reference only):

write(fs) -> None
@spec write(t(), Evision.FileStorage.t(), binary()) :: t() | {:error, String.t()}

write

Positional Arguments

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None