49 #include <pcl/pcl_exports.h>
52 #include <opencv2/core/core.hpp>
53 #include <opencv2/gpu/gpu.hpp>
73 int merge(
int set1,
int set2);
82 void operator =(
const DjSets&);
90 GraphEdge(
int to,
int next,
const T& val) : to(to), next(next), val(val) {}
103 Graph(
int numv,
int nume_max);
105 void addEdge(
int from,
int to,
const T& val=T());
115 void operator =(
const Graph&);
125 return dr + dsp < other.
dr + other.
dsp;
136 : from(from), to(to), val(val) {}
139 return val < other.
val;
150 DjSets::DjSets(
int n)
156 inline int DjSets::find(
int elem)
159 while (set != parent[set])
161 while (elem != parent[elem])
163 int next = parent[elem];
170 inline void DjSets::init(
int n)
175 for (
int i = 0; i < n; ++i)
179 inline int DjSets::merge(
int set1,
int set2)
181 if (rank[set1] < rank[set2])
184 size[set2] += size[set1];
187 if (rank[set2] < rank[set1])
190 size[set1] += size[set2];
195 size[set2] += size[set1];
200 template <
typename T>
209 template <
typename T>
212 edges[nume] = Edge(to, start[from], val);
218 inline int pix(
int y,
int x,
int ncols)
220 return y * ncols + x;
230 inline int dist2(
const cv::Vec4b& lhs,
const cv::Vec4b& rhs)
232 return sqr(lhs[0] - rhs[0]) +
sqr(lhs[1] - rhs[1]) +
sqr(lhs[2] - rhs[2]);
236 inline int dist2(
const cv::Vec2s& lhs,
const cv::Vec2s& rhs)
238 return sqr(lhs[0] - rhs[0]) +
sqr(lhs[1] - rhs[1]);
243 PCL_EXPORTS
void meanShiftSegmentation(
const cv::gpu::GpuMat& src, cv::Mat& dst,
int sp,
int sr,
int minsize, detail::DjSets &comps, cv::TermCriteria criteria = cv::TermCriteria(cv::TermCriteria::MAX_ITER + cv::TermCriteria::EPS, 5, 1) );
SegmLink(int from, int to, const SegmLinkVal &val)
int pix(int y, int x, int ncols)
This file defines compatibility wrappers for low level I/O functions.
SegmLinkVal(int dr, int dsp)
int dist2(const cv::Vec4b &lhs, const cv::Vec4b &rhs)
PCL_EXPORTS void meanShiftSegmentation(const cv::gpu::GpuMat &src, cv::Mat &dst, int sp, int sr, int minsize, detail::DjSets &comps, cv::TermCriteria criteria=cv::TermCriteria(cv::TermCriteria::MAX_ITER+cv::TermCriteria::EPS, 5, 1))
GraphEdge(int to, int next, const T &val)
void addEdge(int from, int to, const T &val=T())