OpenCV  4.5.5
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::hfs::HfsSegment Class Referenceabstract

#include <opencv2/hfs.hpp>

Inheritance diagram for cv::hfs::HfsSegment:
cv::Algorithm

Public Member Functions

virtual int getMinRegionSizeI ()=0
 
virtual int getMinRegionSizeII ()=0
 
virtual int getNumSlicIter ()=0
 
virtual float getSegEgbThresholdI ()=0
 
virtual float getSegEgbThresholdII ()=0
 
virtual int getSlicSpixelSize ()=0
 
virtual float getSpatialWeight ()=0
 
virtual Mat performSegmentCpu (InputArray src, bool ifDraw=true)=0
 do segmentation with cpu This method is only implemented for reference. It is highly NOT recommanded to use it. More...
 
virtual Mat performSegmentGpu (InputArray src, bool ifDraw=true)=0
 do segmentation gpu More...
 
virtual void setMinRegionSizeI (int n)=0
 : 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. More...
 
virtual void setMinRegionSizeII (int n)=0
 : set and get the parameter minRegionSizeII. This parameter is used in the third stage mentioned above. It serves the same purpose as minRegionSizeI More...
 
virtual void setNumSlicIter (int n)=0
 : set and get the parameter numSlicIter. This parameter is used in the first stage. It describes how many iteration to perform when executing SLIC. More...
 
virtual void setSegEgbThresholdI (float c)=0
 : 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. More...
 
virtual void setSegEgbThresholdII (float c)=0
 : 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. More...
 
virtual void setSlicSpixelSize (int n)=0
 : 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 \(slicSpixelSize \times slicSpixelSize\) pixels in the beginning. More...
 
virtual void setSpatialWeight (float w)=0
 : 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 \(colorDistance + spatialWeight \times spatialDistance\). The segmentation result tends to have more local consistency if this value is larger. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Static Public Member Functions

static Ptr< HfsSegmentcreate (int height, int width, float segEgbThresholdI=0.08f, int minRegionSizeI=100, float segEgbThresholdII=0.28f, int minRegionSizeII=200, float spatialWeight=0.6f, int slicSpixelSize=8, int numSlicIter=5)
 : create a hfs object More...
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Member Function Documentation

◆ create()

static Ptr<HfsSegment> cv::hfs::HfsSegment::create ( int  height,
int  width,
float  segEgbThresholdI = 0.08f,
int  minRegionSizeI = 100,
float  segEgbThresholdII = 0.28f,
int  minRegionSizeII = 200,
float  spatialWeight = 0.6f,
int  slicSpixelSize = 8,
int  numSlicIter = 5 
)
static
Python:
cv.hfs.HfsSegment_create(height, width[, segEgbThresholdI[, minRegionSizeI[, segEgbThresholdII[, minRegionSizeII[, spatialWeight[, slicSpixelSize[, numSlicIter]]]]]]]) -> retval

: create a hfs object

Parameters
heightthe height of the input image
widththe width of the input image
segEgbThresholdIparameter segEgbThresholdI
minRegionSizeIparameter minRegionSizeI
segEgbThresholdIIparameter segEgbThresholdII
minRegionSizeIIparameter minRegionSizeII
spatialWeightparameter spatialWeight
slicSpixelSizeparameter slicSpixelSize
numSlicIterparameter numSlicIter

◆ getMinRegionSizeI()

virtual int cv::hfs::HfsSegment::getMinRegionSizeI ( )
pure virtual
Python:
cv.hfs_HfsSegment.getMinRegionSizeI() -> retval

◆ getMinRegionSizeII()

virtual int cv::hfs::HfsSegment::getMinRegionSizeII ( )
pure virtual
Python:
cv.hfs_HfsSegment.getMinRegionSizeII() -> retval

◆ getNumSlicIter()

virtual int cv::hfs::HfsSegment::getNumSlicIter ( )
pure virtual
Python:
cv.hfs_HfsSegment.getNumSlicIter() -> retval

◆ getSegEgbThresholdI()

virtual float cv::hfs::HfsSegment::getSegEgbThresholdI ( )
pure virtual
Python:
cv.hfs_HfsSegment.getSegEgbThresholdI() -> retval

◆ getSegEgbThresholdII()

virtual float cv::hfs::HfsSegment::getSegEgbThresholdII ( )
pure virtual
Python:
cv.hfs_HfsSegment.getSegEgbThresholdII() -> retval

◆ getSlicSpixelSize()

virtual int cv::hfs::HfsSegment::getSlicSpixelSize ( )
pure virtual
Python:
cv.hfs_HfsSegment.getSlicSpixelSize() -> retval

◆ getSpatialWeight()

virtual float cv::hfs::HfsSegment::getSpatialWeight ( )
pure virtual
Python:
cv.hfs_HfsSegment.getSpatialWeight() -> retval

◆ performSegmentCpu()

virtual Mat cv::hfs::HfsSegment::performSegmentCpu ( InputArray  src,
bool  ifDraw = true 
)
pure virtual
Python:
cv.hfs_HfsSegment.performSegmentCpu(src[, ifDraw]) -> retval

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

◆ performSegmentGpu()

virtual Mat cv::hfs::HfsSegment::performSegmentGpu ( InputArray  src,
bool  ifDraw = true 
)
pure virtual
Python:
cv.hfs_HfsSegment.performSegmentGpu(src[, ifDraw]) -> retval

do segmentation gpu

Parameters
srcthe input image
ifDrawif 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

◆ setMinRegionSizeI()

virtual void cv::hfs::HfsSegment::setMinRegionSizeI ( int  n)
pure virtual
Python:
cv.hfs_HfsSegment.setMinRegionSizeI(n) -> 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.

◆ setMinRegionSizeII()

virtual void cv::hfs::HfsSegment::setMinRegionSizeII ( int  n)
pure virtual
Python:
cv.hfs_HfsSegment.setMinRegionSizeII(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

◆ setNumSlicIter()

virtual void cv::hfs::HfsSegment::setNumSlicIter ( int  n)
pure virtual
Python:
cv.hfs_HfsSegment.setNumSlicIter(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.

◆ setSegEgbThresholdI()

virtual void cv::hfs::HfsSegment::setSegEgbThresholdI ( float  c)
pure virtual
Python:
cv.hfs_HfsSegment.setSegEgbThresholdI(c) -> 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.

◆ setSegEgbThresholdII()

virtual void cv::hfs::HfsSegment::setSegEgbThresholdII ( float  c)
pure virtual
Python:
cv.hfs_HfsSegment.setSegEgbThresholdII(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.

◆ setSlicSpixelSize()

virtual void cv::hfs::HfsSegment::setSlicSpixelSize ( int  n)
pure virtual
Python:
cv.hfs_HfsSegment.setSlicSpixelSize(n) -> 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 \(slicSpixelSize \times slicSpixelSize\) pixels in the beginning.

◆ setSpatialWeight()

virtual void cv::hfs::HfsSegment::setSpatialWeight ( float  w)
pure virtual
Python:
cv.hfs_HfsSegment.setSpatialWeight(w) -> 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 \(colorDistance + spatialWeight \times spatialDistance\). The segmentation result tends to have more local consistency if this value is larger.


The documentation for this class was generated from the following file: