Superpixel API¶
These classes define image superpixel data structures.
Defined in src/imgproc/Region.h
, src/imgproc/SLICData.h
, src/imgproc/SLIC.h
-
class Caesar::Region : public Caesar::Blob¶
Public Types
Public Functions
-
Region()¶
Class constructor: initialize structures.
-
Region(std::string name)¶
Parametric constructor.
-
virtual ~Region()¶
Class destructor: free allocated memory.
-
void Copy(TObject ®ion) const¶
Copy method.
-
Region::RegionPars *GetParams(bool includeCurvPar = true)¶
Get region parameters.
-
int GetDistance(DistPars &distPars, Region *aRegion, bool useRobustParams = false)¶
Get distance squared between this and given region.
-
int GetAsymmDistance(DistPars &distPars, DistPars &distPars_neighbor, Region *aRegion, bool useRobustParams = false)¶
Get asymmetric color & space symmetric distance between this and given region.
-
int AddRegion(Region *aRegion, bool addPixels = true, bool copyPixels = false)¶
Get color & space symmetric distance among two regions.
Get color & space asymmetric distance among two regions Merge a region to this
-
int AddSubRegionId(long int id)¶
Add a sub-region id to list.
-
inline int GetNSubRegions()¶
Get number of sub-regions present in list.
-
inline const std::vector<long int> &GetSubRegionIds() const¶
Get the list of sub-region ids.
-
inline long int GetSubRegionId(int index)¶
Get sub-region id at given index.
-
Region()¶
-
class Caesar::RegionCollection : public TObject¶
Public Functions
-
inline RegionCollection()¶
Constructor.
-
inline virtual ~RegionCollection()¶
Destructor.
-
inline int GetN()¶
Get number of regions present in collection.
-
inline int FindRegion(int id)¶
Find region (return index with given id)
-
inline std::map<int, int> GetRegionIdMap() const¶
Get region map regionId>index.
-
inline std::map<int, int> GetRegionIndexMap() const¶
Get region index map (index>regionId)
-
inline RegionCollection()¶
-
class Caesar::SLICData : public TObject¶
Public Functions
-
SLICData()¶
Class constructor: initialize structures.
-
virtual ~SLICData()¶
Class destructor: free allocated memory.
-
void Copy(TObject ®ion) const¶
Copy method.
-
void Clear()¶
Clear data.
-
void ClearImages()¶
Clear images.
-
void ClearRegions()¶
Clear regions.
-
int SetData(Image *img, Image *lapl_img, Image *edge_img = 0)¶
Set data (NB: Pointer ownership is taken by this class)
-
int SPGenerator(Image *img, int regionSize = 10, double regParam = 1, int minRegionSize = 10, bool useLogScaleMapping = false, Image *edgeImg = 0)¶
Generate a superpixel partition given the passed options.
-
Image *GetSegmentedImage(Image *image, int selectedTag = -1, bool normalize = false, bool binarize = false)¶
Get segmented image.
-
inline int GetNRegions() const¶
Get number of regions.
-
inline long int GetRegionId(long int index)¶
Get region id from index (NB: No check done)
-
inline long int GetRegionSize(long int index)¶
Get region size from index (NB: No check done)
-
int ComputeRegionParameters()¶
Compute region parameters.
-
void RemoveEmptyRegions()¶
Remove regions without pixels.
-
inline void DeleteRegions(std::vector<size_t> const &delete_indexes)¶
Delete regions specified in the list (NB: No check done)
-
void GetRegionIdMap(std::map<long int, long int> ®ionIdMap) const¶
Get region map regionId>index.
-
void GetRegionIndexMap(std::map<long int, long int> ®ionIndexMap) const¶
Get region index map (index>regionId)
-
inline void SetPixelLabels(std::vector<long int> list)¶
Set pixel labels.
-
int SetPixelLabel(long int gBin, long int label, bool check = true)¶
Set pixel label (NB: No check done)
-
inline void ScalePixelLabel(long int gBin, long int scale)¶
Scale pixel label (NB: No check done)
-
inline long int GetPixelLabel(long int ix, long int iy)¶
Get pixel label (NB: No check is done)
-
inline long int GetPixelLabel(long int gBin)¶
Get pixel label (NB: No check is done)
-
inline double GetScurv(long int ix, long int iy)¶
Get curvature pixel value (NB: No check is done!)
-
double GetSedge(long int ix, long int iy)¶
Get edgeness pixel value.
-
inline double GetS(long int ix, long int iy)¶
Get pixel value (NB: No check is done!)
-
inline void SetRegionId(int index, int id)¶
Set region id (NB: No checks performed)
-
SLICData()¶
-
class Caesar::SLICContourData : public TObject¶
-
class Caesar::SLICNeighborData : public TObject¶
Public Functions
-
inline bool operator==(const SLICNeighborData &aNeighborData) const¶
SLIC neighbor data equality operator for comparison.
-
inline void Print()¶
Print neighbor data info.
-
inline bool operator==(const SLICNeighborData &aNeighborData) const¶
-
class Caesar::SLICNeighborCollection : public TObject¶
Public Functions
-
inline void Add(SLICNeighborData nn)¶
Add a SLIC neighbor data to collection.
-
inline int GetN()¶
Get number of neighbor data present in collection.
-
inline int FindCloserByDiss()¶
Find the closest neighbor data in collection wrt dissimilarity.
-
inline int FindCloserByDissTot()¶
Find the closest neighbor data in collection wrt total dissimilarity.
-
inline std::vector<SLICNeighborData> GetNSortedByDiss(int N)¶
Find the closest neighbor data in collection in dissimilarity.
-
inline std::vector<SLICNeighborData> GetNSortedByTotDiss(int N)¶
Returns the number of SLIC neighbor data sorted by total dissimilarity.
-
inline bool IsIdAmongNClosersByDiss(int id, int N)¶
Check if neighbor data with given id is among the closest N in collection wrt dissimilarity measure.
-
inline bool IsIdAmongNClosersByTotDiss(int id, int N)¶
Check if neighbor data with given id is among the closest N in collection wrt total dissimilarity measure.
-
inline bool IsIndexAmongNClosersByDiss(int index, int N)¶
Check if neighbor data with given index is among the closest N in collection wrt dissimilarity measure.
-
inline bool IsIndexAmongNClosersByTotDiss(int index, int N)¶
Check if neighbor data with given index is among the closest N in collection wrt total dissimilarity measure.
-
inline void Print()¶
Print neighbor data collection info.
-
inline const std::vector<SLICNeighborData> &GetNeighbors() const¶
Returns SLIC neighbor data collection.
-
inline SLICNeighborData *GetNeighbor(int index)¶
Returns SLIC neighbor data with given index in collection.
-
int SetDtot(int index, double Dtot, double Dtot_n)¶
Set total dissimilarity info of neighbor data with the given index in collection.
-
inline void Add(SLICNeighborData nn)¶
-
class Caesar::SLICSimilarityData : public TObject¶
-
class Caesar::SLIC : public TObject¶
Public Functions
-
SLIC()¶
Class constructor: initialize structures.
-
virtual ~SLIC()¶
Class destructor: free allocated memory.
Public Static Functions
-
static SLICData *SPGenerator(Image *img, int regionSize = 20, double regParam = 1, int minRegionSize = 10, bool normalizeImage = true, bool useLogScaleMapping = false, Image *laplImg = 0, Image *edgeImg = 0)¶
Generate superpixel partition.
-
static SLICContourData *ComputeBoundaryContours(SLICData *slicData)¶
Compute superpixel boundary contours.
-
static SLICSimilarityData *ComputeRegionSimilarity(SLICData *slicData, std::vector<SLICNeighborCollection> &neighbors, double beta = 0.5)¶
Compute region similarities.
-
static int FindNeighbors(std::vector<SLICNeighborCollection> &neighbors, SLICData *slicData, SLICContourData *contourData, bool get2ndNeighbors = true, int selectedTag = -1, bool includeSpatialDist = false, bool normalizeParams = true, bool useRobustParams = false, bool addCurvDist = true)¶
Find superpixel neighbors.
-
static Image *GetSegmentedImage(Image *img, std::vector<Region*> const ®ions, int selectedTag = -1, bool normalize = false, bool binarize = false)¶
Compute segmented image given a list of tagged regions.
-
static int CountTaggedRegions(std::vector<Region*> const ®ions, int &NSig, int &NBkg, int &NUntagged)¶
Count number of regions per tag.
-
static int TagRegions(std::vector<Region*> ®ions, Image *binaryMap_bkg, Image *binaryMap_signal)¶
Tag regions into signal/bkg according to signal & bkg marker images.
-
SLIC()¶