123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #ifndef __OPENCV_XIMGPROC_SEGMENTATION_HPP__
- #define __OPENCV_XIMGPROC_SEGMENTATION_HPP__
- #include <opencv2/core.hpp>
- namespace cv {
- namespace ximgproc {
- namespace segmentation {
-
-
-
- class CV_EXPORTS_W GraphSegmentation : public Algorithm {
- public:
-
- CV_WRAP virtual void processImage(InputArray src, OutputArray dst) = 0;
- CV_WRAP virtual void setSigma(double sigma) = 0;
- CV_WRAP virtual double getSigma() = 0;
- CV_WRAP virtual void setK(float k) = 0;
- CV_WRAP virtual float getK() = 0;
- CV_WRAP virtual void setMinSize(int min_size) = 0;
- CV_WRAP virtual int getMinSize() = 0;
- };
-
- CV_EXPORTS_W Ptr<GraphSegmentation> createGraphSegmentation(double sigma=0.5, float k=300, int min_size=100);
-
-
- class Edge {
- public:
- int from;
- int to;
- float weight;
- bool operator <(const Edge& e) const {
- return weight < e.weight;
- }
- };
-
- class PointSetElement {
- public:
- int p;
- int size;
- PointSetElement() { }
- PointSetElement(int p_) {
- p = p_;
- size = 1;
- }
- };
-
- class PointSet {
- public:
- PointSet(int nb_elements_);
- ~PointSet();
- int nb_elements;
-
- int getBasePoint(int p);
-
- void joinPoints(int p_a, int p_b);
-
- int size(unsigned int p) { return mapping[p].size; }
- private:
- PointSetElement* mapping;
- };
- }
- }
- }
- #endif
|