![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpRect.h>
Public Member Functions | |
| vpRect () | |
| vpRect (double left, double top, double width, double height) | |
| vpRect (const vpImagePoint &topLeft, double width, double height) | |
| vpRect (const vpImagePoint &topLeft, const vpImagePoint &bottomRight) | |
| vpRect (const vpRect &r) | |
| VP_EXPLICIT | vpRect (const std::vector< vpImagePoint > &ip) |
| double | getArea () const |
| double | getBottom () const |
| vpImagePoint | getBottomLeft () const |
| vpImagePoint | getBottomRight () const |
| void | getCenter (double &x, double &y) const |
| vpImagePoint | getCenter () const |
| double | getHeight () const |
| double | getLeft () const |
| double | getRight () const |
| double | getSize () const |
| double | getTop () const |
| vpImagePoint | getTopLeft () const |
| vpImagePoint | getTopRight () const |
| double | getWidth () const |
| bool | isInside (const vpImagePoint &ip) const |
| bool | operator== (const vpRect &r) const |
| bool | operator!= (const vpRect &r) const |
| vpRect & | operator&= (const vpRect &r) |
| vpRect & | operator= (const vpRect &r) |
| vpRect | operator& (const vpRect &r) const |
| void | set (double left, double top, double width, double height) |
| void | set (const vpImagePoint &topLeft, double width, double height) |
| void | set (const vpImagePoint &topLeft, const vpImagePoint &bottomRight) |
| void | set (const vpRect &r) |
| void | set (const std::vector< vpImagePoint > &ip) |
| void | setBottom (double pos) |
| void | setBottomRight (const vpImagePoint &bottomRight) |
| void | setHeight (double h) |
| void | setLeft (double pos) |
| void | setRect (double l, double t, double w, double h) |
| void | setRight (double pos) |
| void | setTop (double pos) |
| void | setTopLeft (const vpImagePoint &topLeft) |
| void | setWidth (double w) |
| void | moveCenter (double x, double y) |
| void | moveCenter (const vpImagePoint ¢er) |
Friends | |
| VISP_EXPORT bool | inRectangle (const vpImagePoint &ip, const vpRect &rect) |
| VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpRect &r) |
Defines a rectangle in the plane.
A rectangle is internally represented as an upper-left corner and a width and height, but it is normally expressed as an upper-left corner and bottom-right corner.
Note that the size (width and height) of a rectangle might be different from what you are used to. If the top-left corner and the bottom-right corner are the same, the height and the width of the rectangle will both be 1.
Generally, width = right - left + 1 and height = bottom - top + 1.
We designed it this way to make it correspond to rectangular spaces used by drawing functions in which the width and height denote a number of pixels. For example, drawing a rectangle with width and height 1 draws a single pixel.
The default coordinate system has origin (0, 0) in the top-left corner. The positive direction of the y axis is down, and the positive x axis is from left to right.
A vpRect can be constructed with a set of left, top, width and height double. After creation the dimensions can be changed, e.g. with setLeft(), setRight(), setTop() and setBottom(), or by setting sizes, e.g. setWidth(), setHeight()
| BEGIN_VISP_NAMESPACE vpRect::vpRect | ( | ) |
Constructs a default rectangle with the top, left corner set to (0,0) and width and height set to 1.
Definition at line 48 of file vpRect.cpp.
Referenced by inRectangle, operator!=(), operator&(), operator&=(), operator<<, operator=(), operator==(), set(), and vpRect().
| vpRect::vpRect | ( | double | l, |
| double | t, | ||
| double | w, | ||
| double | h ) |
Constructs a rectangle with the top, left corner and width and height.
| l | : coordinate of the top/left corner along the horizontal axis. |
| t | : coordinate of the top/left corner along the vertical axis. |
| w | : rectangle width. |
| h | : rectangle height. |
Definition at line 59 of file vpRect.cpp.
| vpRect::vpRect | ( | const vpImagePoint & | topLeft, |
| double | w, | ||
| double | h ) |
Constructs a rectangle with topLeft the top-left corner location and width and height the rectangle size.
| topLeft | : coordinates of the top/left corner. |
| w | : rectangle width. |
| h | : rectangle height. |
Definition at line 69 of file vpRect.cpp.
| vpRect::vpRect | ( | const vpImagePoint & | topLeft, |
| const vpImagePoint & | bottomRight ) |
Constructs a rectangle with topLeft the top-left corner location and bottomRight the bottom-right corner.
Definition at line 77 of file vpRect.cpp.
References vpImagePoint::get_u(), vpImagePoint::get_v(), setBottom(), and setRight().
| vpRect::vpRect | ( | const vpRect & | r | ) |
Constructs a rectangle that is a copy of r.
Definition at line 90 of file vpRect.cpp.
References vpRect().
| vpRect::vpRect | ( | const std::vector< vpImagePoint > & | ip | ) |
Create a rectangle as the bounding box of a vector of image points.
| ip | : Vector of image points. At least 1 points is mandatory, otherwise an exception is thrown. |
Definition at line 110 of file vpRect.cpp.
References set().
|
inline |
Returns the area of the rectangle.
Definition at line 91 of file vpRect.h.
Referenced by vpRBDenseDepthTracker::computeVVSIter(), and vpDetectorDNNOpenCV::filterDetectionMultiClassInput().
|
inline |
Returns the bottom coordinate of the rectangle.
Definition at line 97 of file vpRect.h.
Referenced by vpColorHistogram::computeSplitHistograms(), vpKeyPoint::detect(), vpKeyPoint::detect(), getBottomLeft(), getBottomRight(), vpImageSimulator::getImage(), vpImageSimulator::getImage(), vpImagePoint::inRectangle(), inRectangle, vpRBProbabilistic3DDriftDetector::update(), vpColorHistogramMask::updateMask(), vpCombinedDepthAndColorMask::updateMask(), and vpDepthMask::updateMask().
|
inline |
Returns the bottom-left position of the rectangle.
Definition at line 104 of file vpRect.h.
References getBottom(), getLeft(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
inline |
Returns the bottom-right coordinate of the rectangle.
Definition at line 117 of file vpRect.h.
References getBottom(), getRight(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
inline |
Returns the center point of the rectangle. The center point coordinates are (x, y).
The default coordinate system has origin (0, 0) in the top-left corner. The positive direction of the y axis is down, and the positive x axis is from left to right.
Definition at line 152 of file vpRect.h.
References vpImagePoint::set_u(), and vpImagePoint::set_v().
|
inline |
Returns the center point of the rectangle. The center point coordinates are (x, y).
The default coordinate system has origin (0, 0) in the top-left corner. The positive direction of the y axis is down, and the positive x axis is from left to right.
Definition at line 136 of file vpRect.h.
Referenced by vpRectOriented::operator=(), and vpRectOriented::vpRectOriented().
|
inline |
Returns the height of the rectangle. The height includes both the top and bottom edges, i.e. height = bottom - top + 1.
Definition at line 166 of file vpRect.h.
Referenced by vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vpImageCircle::computeAngularCoverageInRoI(), vpImageTools::crop(), vpImageTools::crop(), vpKeyPoint::detect(), vpKeyPoint::detect(), vpDisplayOpenCV::displayRectangle(), vpDisplayWin32::displayRectangle(), vpDisplayX::displayRectangle(), vpRectOriented::operator=(), and vpRectOriented::vpRectOriented().
|
inline |
Returns the left coordinate of the rectangle.
Definition at line 173 of file vpRect.h.
Referenced by vpV4l2Grabber::acquire(), vpColorHistogram::computeSplitHistograms(), vpImageTools::crop(), vpImageTools::crop(), vpKeyPoint::detect(), vpKeyPoint::detect(), vpDisplayWin32::displayRectangle(), getBottomLeft(), vpImageSimulator::getImage(), vpImageSimulator::getImage(), getTopLeft(), vpImagePoint::inRectangle(), inRectangle, vpRBProbabilistic3DDriftDetector::update(), vpColorHistogramMask::updateMask(), vpCombinedDepthAndColorMask::updateMask(), and vpDepthMask::updateMask().
|
inline |
Returns the right coordinate of the rectangle.
Definition at line 179 of file vpRect.h.
Referenced by vpColorHistogram::computeSplitHistograms(), vpKeyPoint::detect(), vpKeyPoint::detect(), vpDisplayGTK::displayRectangle(), getBottomRight(), vpImageSimulator::getImage(), vpImageSimulator::getImage(), getTopRight(), vpImagePoint::inRectangle(), inRectangle, vpRBProbabilistic3DDriftDetector::update(), vpColorHistogramMask::updateMask(), vpCombinedDepthAndColorMask::updateMask(), and vpDepthMask::updateMask().
|
inline |
Returns the size of the rectangle.
|
inline |
Returns the top coordinate of the rectangle.
Definition at line 192 of file vpRect.h.
Referenced by vpV4l2Grabber::acquire(), vpColorHistogram::computeSplitHistograms(), vpImageTools::crop(), vpImageTools::crop(), vpKeyPoint::detect(), vpKeyPoint::detect(), vpDisplayWin32::displayRectangle(), vpImageSimulator::getImage(), vpImageSimulator::getImage(), getTopLeft(), getTopRight(), vpImagePoint::inRectangle(), inRectangle, vpRBProbabilistic3DDriftDetector::update(), vpColorHistogramMask::updateMask(), vpCombinedDepthAndColorMask::updateMask(), and vpDepthMask::updateMask().
|
inline |
Returns the top-left position of the rectangle.
Definition at line 199 of file vpRect.h.
References getLeft(), getTop(), vpImagePoint::set_u(), and vpImagePoint::set_v().
Referenced by vpImageCircle::computeAngularCoverageInRoI(), vpDisplayGTK::displayRectangle(), vpDisplayOpenCV::displayRectangle(), and vpDisplayX::displayRectangle().
|
inline |
Returns the top-right position of the rectangle.
Definition at line 212 of file vpRect.h.
References getRight(), getTop(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
inline |
Returns the width of the rectangle. The width includes both the left and right edges, i.e. width = right - left + 1.
Definition at line 227 of file vpRect.h.
Referenced by vpV4l2Grabber::acquire(), vpV4l2Grabber::acquire(), vpImageCircle::computeAngularCoverageInRoI(), vpImageTools::crop(), vpImageTools::crop(), vpKeyPoint::detect(), vpKeyPoint::detect(), vpDisplayGTK::displayRectangle(), vpDisplayOpenCV::displayRectangle(), vpDisplayWin32::displayRectangle(), vpDisplayX::displayRectangle(), vpRectOriented::operator=(), and vpRectOriented::vpRectOriented().
| bool vpRect::isInside | ( | const vpImagePoint & | ip | ) | const |
Returns true if the point belongs to the rectangle.
Check if an image point belongs to the rectangle.
| ip | : the image point. |
Definition at line 119 of file vpRect.cpp.
References vpImagePoint::get_i(), and vpImagePoint::get_j().
Referenced by vpImageCircle::computeAngularCoverageInRoI().
|
inline |
Center the rectangle to the image point given as parameter, leaving the size unchanged.
Definition at line 403 of file vpRect.h.
References vpImagePoint::get_u(), and vpImagePoint::get_v().
|
inline |
Sets the center point of the rectangle to (x, y), leaving the size unchanged.
| bool vpRect::operator!= | ( | const vpRect & | r | ) | const |
Operator to compare two rectangles.
Definition at line 236 of file vpRect.cpp.
References vpRect().
Assign r to this rectangle and return a reference to this rectangle.
Definition at line 96 of file vpRect.cpp.
References vpRect().
| bool vpRect::operator== | ( | const vpRect & | r | ) | const |
Operator to compare two rectangles.
Definition at line 223 of file vpRect.cpp.
References vpRect().
| void vpRect::set | ( | const std::vector< vpImagePoint > & | ip | ) |
Set the rectangle as the bounding box of a vector of image points.
| ip | : Vector of image points. At least 1 points is mandatory, otherwise an exception is thrown. |
Definition at line 162 of file vpRect.cpp.
References vpException::dimensionError, setBottom(), setLeft(), setRight(), and setTop().
| void vpRect::set | ( | const vpImagePoint & | topLeft, |
| const vpImagePoint & | bottomRight ) |
Set the rectangle with topLeft the top-left corner location and bottomRight the bottom-right corner.
| topLeft | : coordinates of the top-left corner. |
| bottomRight | : coordinates of the bottom-right corner. |
Definition at line 205 of file vpRect.cpp.
References vpImagePoint::get_u(), vpImagePoint::get_v(), setBottom(), and setRight().
| void vpRect::set | ( | const vpImagePoint & | topLeft, |
| double | w, | ||
| double | h ) |
Set the rectangle with topLeft the top-left corner location and width and height the rectangle size.
| topLeft | : coordinates of the top-left corner. |
| w | : rectangle width. |
| h | : rectangle height. |
Definition at line 149 of file vpRect.cpp.
References vpImagePoint::get_u(), and vpImagePoint::get_v().
| void vpRect::set | ( | const vpRect & | r | ) |
| void vpRect::set | ( | double | l, |
| double | t, | ||
| double | w, | ||
| double | h ) |
Set the rectangle with the top, left corner and width and height.
| l | : coordinate of the top/left corner along the horizontal axis. |
| t | : coordinate of the top/left corner along the vertical axis. |
| w | : rectangle width. |
| h | : rectangle height. |
Definition at line 133 of file vpRect.cpp.
Referenced by vpRect().
|
inline |
|
inline |
Sets the bottom-right position of the rectangle. Will never change the top-left position the rectangle.
Definition at line 296 of file vpRect.h.
References vpImagePoint::get_u(), and vpImagePoint::get_v().
Referenced by vpTemplateTrackerZone::getBoundingBox().
|
inline |
Sets the height of the rectangle to h. The top edge is not moved, but the bottom edge may be moved.
|
inline |
Sets the left edge position of the rectangle to pos. May change the right edge position of the rectangle, but will never change the width of the rectangle.
Definition at line 321 of file vpRect.h.
Referenced by set().
|
inline |
Sets the coordinates of the rectangle's top left corner to (left, top), and its size to (width, height).
| l | : horizontal position of the rectangle upper/left corner position. |
| t | : vertical position of the rectangle upper/left corner position. |
| w | : rectangle width. |
| h | : rectangle height. |
Definition at line 333 of file vpRect.h.
Referenced by vpDot2::getBBox(), and vpDot::getBBox().
|
inline |
|
inline |
Sets the top edge position of the rectangle to pos. May change the bottom edge position of the rectangle, but will never change the height of the rectangle.
Definition at line 357 of file vpRect.h.
Referenced by set().
|
inline |
Sets the top-left position of the rectangle. May change the bottom edge position of the rectangle, but will never change the height of the rectangle.
Definition at line 366 of file vpRect.h.
References vpImagePoint::get_u(), and vpImagePoint::get_v().
Referenced by vpTemplateTrackerZone::getBoundingBox().
|
inline |
Sets the width of the rectangle to w. The right edge is changed, but not the left edge.
|
friend |
Check if an image point belongs to a rectangle.
| ip | : the image point. |
| rect | : the rectangle. |
Definition at line 261 of file vpRect.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), getBottom(), getLeft(), getRight(), getTop(), inRectangle, and vpRect().
Referenced by inRectangle.
|
friend |
Definition at line 267 of file vpRect.cpp.
References operator<<, and vpRect().
Referenced by operator<<.