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

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

getDefaultName

getMinRegionSizeI

getMinRegionSizeII

getNumSlicIter

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(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(integer(), integer()) :: t() | {:error, String.t()}

: create a hfs object

Positional Arguments
  • height: int.

    the height of the input image

  • width: int.

    the width of the input image

Keyword Arguments
  • segEgbThresholdI: float.

    parameter segEgbThresholdI

  • minRegionSizeI: int.

    parameter minRegionSizeI

  • segEgbThresholdII: float.

    parameter segEgbThresholdII

  • minRegionSizeII: int.

    parameter minRegionSizeII

  • spatialWeight: float.

    parameter spatialWeight

  • slicSpixelSize: int.

    parameter slicSpixelSize

  • numSlicIter: int.

    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(), [{atom(), term()}, ...] | nil) ::
  t() | {:error, String.t()}

: create a hfs object

Positional Arguments
  • height: int.

    the height of the input image

  • width: int.

    the width of the input image

Keyword Arguments
  • segEgbThresholdI: float.

    parameter segEgbThresholdI

  • minRegionSizeI: int.

    parameter minRegionSizeI

  • segEgbThresholdII: float.

    parameter segEgbThresholdII

  • minRegionSizeII: int.

    parameter minRegionSizeII

  • spatialWeight: float.

    parameter spatialWeight

  • slicSpixelSize: int.

    parameter slicSpixelSize

  • numSlicIter: int.

    parameter numSlicIter

Return
  • retval: HfsSegment

Python prototype (for reference only):

create(height, width[, segEgbThresholdI[, minRegionSizeI[, segEgbThresholdII[, minRegionSizeII[, spatialWeight[, slicSpixelSize[, numSlicIter]]]]]]]) -> retval
@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
@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
@spec getMinRegionSizeI(t()) :: integer() | {:error, String.t()}

getMinRegionSizeI

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

Python prototype (for reference only):

getMinRegionSizeI() -> retval
Link to this function

getMinRegionSizeII(self)

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

getMinRegionSizeII

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

Python prototype (for reference only):

getMinRegionSizeII() -> retval
@spec getNumSlicIter(t()) :: integer() | {:error, String.t()}

getNumSlicIter

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

Python prototype (for reference only):

getNumSlicIter() -> retval
Link to this function

getSegEgbThresholdI(self)

View Source
@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(self)

View Source
@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
@spec getSlicSpixelSize(t()) :: integer() | {:error, String.t()}

getSlicSpixelSize

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

Python prototype (for reference only):

getSlicSpixelSize() -> retval
@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(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
  • self: Evision.HFS.HfsSegment.t()
  • src: Evision.Mat.t()
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(),
  [{atom(), 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
  • self: Evision.HFS.HfsSegment.t()
  • src: Evision.Mat.t()
Keyword Arguments
  • ifDraw: bool.
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

performSegmentCpu(src[, ifDraw]) -> retval
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.t().

    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(),
  [{atom(), term()}, ...] | nil
) ::
  Evision.Mat.t() | {:error, String.t()}

do segmentation gpu

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

  • src: Evision.Mat.t().

    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(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

Reads algorithm parameters from a file storage

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

Python prototype (for reference only):

read(fn_) -> None
@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(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: int

Python prototype (for reference only):

setMinRegionSizeI(n) -> None
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: int

Python prototype (for reference only):

setMinRegionSizeII(n) -> None
@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: int

Python prototype (for reference only):

setNumSlicIter(n) -> None
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(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(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: int

Python prototype (for reference only):

setSlicSpixelSize(n) -> None
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(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

Stores algorithm parameters in a file storage

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

Python prototype (for reference only):

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

write

Positional Arguments
  • self: Evision.HFS.HfsSegment.t()
  • fs: Evision.FileStorage.t()
  • name: String

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None