Go to the documentation of this file.00001
00059
00060
00061
00062
00063
00064
00065
00066 #ifndef POLYGON_EXTRACTION_H_
00067 #define POLYGON_EXTRACTION_H_
00068
00069 #include <vector>
00070 #include <stack>
00071 #include <algorithm>
00072
00073 namespace cob_3d_segmentation
00074 {
00075
00076
00077
00078
00079
00080
00081
00082 class PolygonExtraction
00083 {
00084 int *ch_;
00085 size_t ch_size_;
00086 bool *outline_check_;
00087 size_t outline_check_size_;
00088
00089 template <typename TPoint>
00090 static int getPos(int *ch, const int xx, const int yy, const int w, const int h);
00091
00092 inline bool hasMultiplePositions(unsigned int i) { return !((i != 0) && ((i & (~i + 1)) == i)); }
00093
00094 public:
00095 PolygonExtraction();
00096
00097 virtual ~PolygonExtraction()
00098 {
00099 delete [] ch_;
00100 delete [] outline_check_;
00101 }
00102
00103 template<typename TPoint, typename TPolygon>
00104 void outline(const int w, const int h, std::vector<TPoint> out, TPolygon &poly);
00105 void ppm(const char *fn, const int w, const int h, const int *ch);
00106
00107 };
00108 }
00109
00110 #endif