73#include <visp3/core/vpColor.h>
74#include <visp3/core/vpImage.h>
75#include <visp3/core/vpPolygon.h>
116 const unsigned int dir0 = 0, dir1 = 1, dir2 = 2, dir3 = 3;
117 const unsigned int dir4 = 4, dir5 = 5, dir6 = 6, dir7 = 7;
174 int yy =
static_cast<int>(point.get_i() +
m_diry[
static_cast<int>(
m_direction)]);
175 int xx =
static_cast<int>(point.get_j() +
m_dirx[
static_cast<int>(
m_direction)]);
177 if ((xx < 0) || (xx >=
static_cast<int>(I.getWidth())) || (yy < 0) || (yy >=
static_cast<int>(I.getHeight()))) {
181 int pixel = I[yy][xx];
182 return pixel != 0 ? VISP_NAMESPACE_ADDRESSING
vpImagePoint(yy, xx) : VISP_NAMESPACE_ADDRESSING
vpImagePoint(-1, -1);
218 std::vector<VISP_NAMESPACE_ADDRESSING vpImagePoint>
m_points;
238 std::vector<vpContour *>::const_iterator contour_m_children_end = contour.
m_children.end();
239 for (std::vector<vpContour *>::const_iterator it = contour.
m_children.begin(); it != contour_m_children_end;
241 vpContour *copy = new vpContour(**it);
242 copy->m_parent = this;
243 m_children.push_back(copy);
252 std::vector<vpContour *>::iterator m_children_end =
m_children.end();
253 for (std::vector<vpContour *>::iterator it =
m_children.begin(); it != m_children_end; ++it) {
254 (*it)->m_parent =
nullptr;
255 if (*it !=
nullptr) {
271 std::vector<vpContour *>::iterator m_children_end =
m_children.end();
272 for (std::vector<vpContour *>::iterator it =
m_children.begin(); it != m_children_end; ++it) {
273 (*it)->m_parent =
nullptr;
274 if (*it !=
nullptr) {
287 std::vector<vpContour *>::const_iterator other_m_children_end = other.
m_children.end();
288 for (std::vector<vpContour *>::const_iterator it = other.
m_children.begin(); it != other_m_children_end; ++it) {
304 if (parent !=
nullptr) {
320 unsigned char grayValue = 255);
332 const VISP_NAMESPACE_ADDRESSING
vpColor &color);
346 std::vector<std::vector<VISP_NAMESPACE_ADDRESSING vpImagePoint> > &contourPts,
VISP_NAMESPACE_ADDRESSING vpImagePoint active(const VISP_NAMESPACE_ADDRESSING vpImage< int > &I, const VISP_NAMESPACE_ADDRESSING vpImagePoint &point)
vpDirection counterClockwise()
vpDirectionType m_direction
Direction.
int m_diry[8]
Pixel increment along y to reach a given direction.
int m_dirx[8]
Pixel increment along x to reach a given direction.
Class to define RGB colors available for display functionalities.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
static float modulo(const float &value, const float &modulo)
Gives the rest of value divided by modulo when the quotient can only be an integer.
VISP_EXPORT void findContours(const VISP_NAMESPACE_ADDRESSING vpImage< unsigned char > &I_original, vpContour &contours, std::vector< std::vector< VISP_NAMESPACE_ADDRESSING vpImagePoint > > &contourPts, const vpContourRetrievalType &retrievalMode=CONTOUR_RETR_TREE)
VISP_EXPORT void drawContours(VISP_NAMESPACE_ADDRESSING vpImage< unsigned char > &I, const std::vector< std::vector< VISP_NAMESPACE_ADDRESSING vpImagePoint > > &contours, unsigned char grayValue=255)
@ SOUTH_EAST
South-East direction.
@ SOUTH_WEST
South-West direction.
@ NORTH_EAST
North-East direction.
@ LAST_DIRECTION
Number of possible directions.
@ NORTH_WEST
North-West direction.
std::vector< vpContour * > m_children
Children contour.
VP_EXPLICIT vpContour(const vpContourType &type)
std::vector< VISP_NAMESPACE_ADDRESSING vpImagePoint > m_points
Vector of points belonging to the contour.
vpContourType m_contourType
Contour type.
vpContour * m_parent
Parent contour.
vpContour(const vpContour &contour)
void setParent(vpContour *parent)
vpContour & operator=(const vpContour &other)