View Source Evision.HFS.HfsSegment (Evision v0.2.9)
Summary
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
do segmentation gpu
Reads algorithm parameters from a file storage
save
: 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
write
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
: 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 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
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}
getDefaultName
Positional Arguments
- self:
Evision.HFS.HfsSegment.t()
Return
- retval:
String
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(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
@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
@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
@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
@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
@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
@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
@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
Keyword Arguments
- ifDraw:
bool
.
Return
- retval:
Evision.Mat.t()
Python prototype (for reference only):
performSegmentCpu(src[, ifDraw]) -> retval
@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
- self:
Evision.HFS.HfsSegment.t()
- src:
Evision.Mat
Keyword Arguments
- ifDraw:
bool
.
Return
- retval:
Evision.Mat.t()
Python prototype (for reference only):
performSegmentCpu(src[, ifDraw]) -> retval
@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
@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(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}
Reads algorithm parameters from a file storage
Positional Arguments
- self:
Evision.HFS.HfsSegment.t()
- func:
Evision.FileNode
Python prototype (for reference only):
read(fn) -> None
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
: 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
: 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
: 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
: 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
: 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
: 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
: 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
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
- name:
String
Has overloading in C++
Python prototype (for reference only):
write(fs, name) -> None