75 #ifndef _vpContours_h_ 76 #define _vpContours_h_ 78 #include <visp3/core/vpColor.h> 79 #include <visp3/core/vpImage.h> 80 #include <visp3/core/vpPolygon.h> 97 vpDirectionType m_direction;
123 vpDirection clockwise()
125 vpDirection direction;
126 int directionSize = LAST_DIRECTION;
127 direction.m_direction = vpDirectionType(((
int)m_direction + 1) % directionSize);
132 vpDirection counterClockwise()
134 vpDirection direction;
135 int directionSize = (int)LAST_DIRECTION;
137 direction.m_direction = vpDirectionType(idx);
144 int yy = (int)(point.
get_i() + m_diry[(int)m_direction]);
145 int xx = (int)(point.
get_j() + m_dirx[(int)m_direction]);
151 int pixel = I[yy][xx];
179 vpContour(
const vpContourType &type) : m_children(), m_contourType(type), m_parent(NULL), m_points() {}
182 : m_children(), m_contourType(contour.m_contourType), m_parent(NULL), m_points(contour.m_points)
186 for (std::vector<vpContour *>::const_iterator it = contour.
m_children.begin(); it != contour.
m_children.end();
190 m_children.push_back(copy);
196 for (std::vector<vpContour *>::iterator it = m_children.begin(); it != m_children.end(); ++it) {
197 (*it)->m_parent = NULL;
209 if (m_parent == NULL) {
211 for (std::vector<vpContour *>::iterator it = m_children.begin(); it != m_children.end(); ++it) {
212 (*it)->m_parent = NULL;
225 for (std::vector<vpContour *>::const_iterator it = other.
m_children.begin(); it != other.
m_children.end(); ++it) {
228 m_children.push_back(copy);
238 if (parent != NULL) {
245 unsigned char grayValue = 255);
250 std::vector<std::vector<vpImagePoint> > &contourPts,
vpContour(const vpContour &contour)
Class to define RGB colors available for display functionnalities.
std::vector< vpImagePoint > m_points
std::vector< vpContour * > m_children
vpContour & operator=(const vpContour &other)
VISP_EXPORT void findContours(const vpImage< unsigned char > &I_original, vpContour &contours, std::vector< std::vector< vpImagePoint > > &contourPts, const vpContourRetrievalType &retrievalMode=vp::CONTOUR_RETR_TREE)
VISP_EXPORT void drawContours(vpImage< vpRGBa > &I, const std::vector< std::vector< vpImagePoint > > &contours, const vpColor &color)
vpContourType m_contourType
unsigned int getHeight() const
vpContour(const vpContourType &type)
void setParent(vpContour *parent)
static int modulo(int a, int n)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
unsigned int getWidth() const
Definition of the vpImage class member functions.