Visual Servoing Platform  version 3.6.1 under development (2024-04-27)
vpImagePoint Class Reference

#include <visp3/core/vpImagePoint.h>

Public Member Functions

 vpImagePoint ()
 
 vpImagePoint (double ii, double jj)
 
 vpImagePoint (const vpImagePoint &ip)
 
virtual ~vpImagePoint ()
 
double get_i () const
 
double get_j () const
 
double get_u () const
 
double get_v () const
 
bool inRectangle (const vpRect &rect) const
 
bool inSegment (const vpImagePoint &start, const vpImagePoint &end) const
 
vpImagePoint nextInSegment (const vpImagePoint &start, const vpImagePoint &end) const
 
vpImagePointoperator= (const vpImagePoint &ip)
 
vpImagePointoperator+= (const vpImagePoint &ip)
 
vpImagePointoperator-= (const vpImagePoint &ip)
 
vpImagePointoperator/= (double scale)
 
vpImagePointoperator*= (double scale)
 
void set_i (double ii)
 
void set_j (double jj)
 
void set_ij (double ii, double jj)
 
void set_u (double u)
 
void set_v (double v)
 
void set_uv (double u, double v)
 

Static Public Member Functions

static double distance (const vpImagePoint &iP1, const vpImagePoint &iP2)
 
static vpRect getBBox (const std::vector< vpImagePoint > &ipVec)
 
static double sqrDistance (const vpImagePoint &iP1, const vpImagePoint &iP2)
 

Friends

VISP_EXPORT bool operator== (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT bool operator!= (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+= (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, int offset)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, unsigned int offset)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, double offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, int offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, unsigned int offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, double offset)
 
VISP_EXPORT vpImagePoint operator* (const vpImagePoint &ip1, double scale)
 
VISP_EXPORT vpImagePoint operator/ (const vpImagePoint &ip1, double scale)
 
VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpImagePoint &ip)
 

Related Functions

(Note that these are not member functions.)

VISP_EXPORT bool operator== (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT bool operator!= (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+= (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, int offset)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, unsigned int offset)
 
VISP_EXPORT vpImagePoint operator+ (const vpImagePoint &ip1, double offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, const vpImagePoint &ip2)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, int offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, unsigned int offset)
 
VISP_EXPORT vpImagePoint operator- (const vpImagePoint &ip1, double offset)
 
VISP_EXPORT vpImagePoint operator* (const vpImagePoint &ip1, double scale)
 
VISP_EXPORT vpImagePoint operator/ (const vpImagePoint &ip1, double scale)
 
VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpImagePoint &ip)
 

Detailed Description

Class that defines a 2D point in an image. This class is useful for image processing and stores only the 2D coordinates given in sub-pixel.

Warning
If you want to define a point thanks to its coordinates given in meter in the object frame, the camera frame or the image plane, you have to use the class vpPoint.

In this class, the 2D coordinates are not necessary integer values. It is easy to manipulate the given coordinates in the two frames used in ViSP : the (i,j) coordinates and the (u,v) coordinates. The two following images illustrate the two coordinate systems.

Warning
An instance of the vpImagePoint class corresponds to a particular point. Thus, if you change the point coordinate using the method set_i(double i), it produces the same effect than if you used the method set_v(double v). These two methods change the same private attribute. It is also true for the two methods set_j(double j) and set_u(double u).
Examples
AROgre.cpp, AROgreBasic.cpp, BSpline.cpp, SickLDMRS-Process.cpp, displayD3D.cpp, displayGTK.cpp, displayOpenCV.cpp, displayX.cpp, displayXMulti.cpp, grabRealSense2_T265.cpp, manDisplay.cpp, mbot-apriltag-2D-half-vs.cpp, poseVirtualVS.cpp, readRealSenseData.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma4Point2DCamVelocity.cpp, servoAfma4Point2DCamVelocityKalman.cpp, servoAfma62DhalfCamVelocity.cpp, servoAfma6AprilTagIBVS.cpp, servoAfma6Ellipse2DCamVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6FourPoints2DCamVelocityLs_cur.cpp, servoAfma6FourPoints2DCamVelocityLs_des.cpp, servoAfma6MegaposePBVS.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Point2DCamVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoAfma6Segment2DCamVelocity.cpp, servoBebop2.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoFlirPtuIBVS.cpp, servoFrankaIBVS.cpp, servoPololuPtuPoint2DJointVelocity.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoUniversalRobotsIBVS.cpp, servoViper650FourPoints2DArtVelocityLs_cur.cpp, servoViper650FourPoints2DCamVelocityLs_cur-SR300.cpp, servoViper650FourPoints2DCamVelocityLs_cur.cpp, servoViper650Point2DCamVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_cur.cpp, servoViper850FourPoints2DArtVelocityLs_des.cpp, servoViper850FourPoints2DCamVelocityLs_cur.cpp, servoViper850FourPointsKinect.cpp, servoViper850Point2DArtVelocity-jointAvoidance-basic.cpp, servoViper850Point2DArtVelocity-jointAvoidance-gpa.cpp, servoViper850Point2DArtVelocity-jointAvoidance-large.cpp, servoViper850Point2DArtVelocity.cpp, servoViper850Point2DCamVelocity.cpp, servoViper850Point2DCamVelocityKalman.cpp, templateTracker.cpp, testAprilTag.cpp, testClick.cpp, testConnectedComponents.cpp, testConvert.cpp, testDisplays.cpp, testFloodFill.cpp, testGenericTracker.cpp, testGenericTrackerDepth.cpp, testImageDraw.cpp, testImageNormalizedCorrelation.cpp, testImagePoint.cpp, testImageTemplateMatching.cpp, testKeyPoint-2.cpp, testKeyPoint-3.cpp, testKeyPoint-4.cpp, testKeyPoint-5.cpp, testKeyPoint-6.cpp, testKeyPoint.cpp, testLineFitting.cpp, testMouseEvent.cpp, testNurbs.cpp, testRealSense2_D435_align.cpp, testRealSense2_D435_opencv.cpp, testRealSense2_T265_images_odometry.cpp, testRealSense2_T265_images_odometry_async.cpp, testRealSense2_T265_odometry.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, testTrackDot.cpp, testVirtuoseWithGlove.cpp, trackDot.cpp, trackDot2.cpp, trackDot2WithAutoDetection.cpp, trackMeCircle.cpp, trackMeEllipse.cpp, trackMeLine.cpp, trackMeNurbs.cpp, tutorial-apriltag-detector.cpp, tutorial-autothreshold.cpp, tutorial-barcode-detector-live.cpp, tutorial-barcode-detector.cpp, tutorial-blob-tracker-live-firewire.cpp, tutorial-blob-tracker-live-v4l2.cpp, tutorial-brightness-adjustment.cpp, tutorial-circle-hough.cpp, tutorial-detection-object-mbt2-deprecated.cpp, tutorial-detection-object-mbt2.cpp, tutorial-draw-circle.cpp, tutorial-draw-frame.cpp, tutorial-flir-ptu-ibvs.cpp, tutorial-flood-fill.cpp, tutorial-homography-from-points.cpp, tutorial-hsv-range-tuner.cpp, tutorial-ibvs-4pts-display.cpp, tutorial-ibvs-4pts-wireframe-camera.cpp, tutorial-ibvs-4pts-wireframe-robot-afma6.cpp, tutorial-ibvs-4pts-wireframe-robot-viper.cpp, tutorial-image-colormap.cpp, tutorial-image-viewer.cpp, tutorial-klt-tracker-live-v4l2.cpp, tutorial-klt-tracker.cpp, tutorial-matching-keypoint-SIFT.cpp, tutorial-matching-keypoint-homography.cpp, tutorial-matching-keypoint.cpp, tutorial-megapose-live-single-object-tracking.cpp, tutorial-munkres-assignment.cpp, tutorial-pose-from-planar-object.cpp, tutorial-pose-from-points-image.cpp, and tutorial-pose-from-qrcode-image.cpp.

Definition at line 81 of file vpImagePoint.h.

Constructor & Destructor Documentation

◆ vpImagePoint() [1/3]

vpImagePoint::vpImagePoint ( )
inline

Default constructor that initialize the coordinates of the image point to zero.

Definition at line 88 of file vpImagePoint.h.

◆ vpImagePoint() [2/3]

vpImagePoint::vpImagePoint ( double  ii,
double  jj 
)
inline

Default constructor that initialize the coordinates of the image thanks to the parameters $ ii $ and $ jj $.

Definition at line 93 of file vpImagePoint.h.

◆ vpImagePoint() [3/3]

vpImagePoint::vpImagePoint ( const vpImagePoint ip)
inline

Copy constructor.

Initialize the coordinates of the image point with ip.

Parameters
ip: An image point.

Definition at line 101 of file vpImagePoint.h.

◆ ~vpImagePoint()

virtual vpImagePoint::~vpImagePoint ( )
inlinevirtual

Destructor.

Definition at line 103 of file vpImagePoint.h.

Member Function Documentation

◆ distance()

◆ get_i()

double vpImagePoint::get_i ( ) const
inline

Gets the point coordinate corresponding to the $ i $ axes in the frame (i,j).

Returns
The value of the coordinate along the $ i $ axes.
See also
get_j(), get_u(), get_v()
Examples
testAprilTag.cpp, tutorial-flood-fill.cpp, and tutorial-hsv-range-tuner.cpp.

Definition at line 114 of file vpImagePoint.h.

Referenced by vpNurbs::computeCurveDersPoint(), vpImageTools::crop(), vpDisplayGTK::displayArrow(), vpDisplayOpenCV::displayArrow(), vpDisplayX::displayArrow(), vpDisplayGTK::displayCross(), vpDisplayOpenCV::displayCross(), vpDisplayX::displayCross(), vpDisplayOpenCV::displayDotLine(), vpDisplayGTK::displayImageROI(), vpDisplayOpenCV::displayImageROI(), vpDisplay::displayLine(), vpKeyPoint::displayMatching(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpDisplayWin32::displayRectangle(), distance(), vpImageDraw::drawArrow(), vpImageDraw::drawCross(), vpImageDraw::drawDottedLine(), vpImageTools::extract(), vp::findContours(), vp::floodFill(), vpMbtDistanceKltCylinder::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getFeaturesForDisplay(), vpMbtFaceDepthNormal::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getModelForDisplay(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCircle::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceLine::getModelForDisplay(), vpPolygon3D::getNbCornerInsideImage(), vpImage< Type >::getValue(), vpMbtDistanceCylinder::initMovingEdge(), vpMbtDistanceLine::initMovingEdge(), vpDot::initTracking(), vpMeLine::initTracking(), vpDot2::initTracking(), inSegment(), vpImage< Type >::insert(), vpImageTools::interpolate(), vpTemplateTrackerTriangle::inTriangle(), vpTriangle::inTriangle(), vpRect::isInside(), vpPolygon::isInside(), vpMeEllipse::leastSquareRobust(), vpWireFrameSimulator::navigation(), nextInSegment(), vpImage< Type >::operator()(), vpRectOriented::operator=(), vpMeTracker::outOfImage(), vpMeEllipse::plugHoles(), vpNurbs::removeCurveKnot(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeNurbs::seekExtremitiesCanny(), vpRectOriented::setOrientation(), vpRectOriented::setPoints(), vpRectOriented::setSize(), sqrDistance(), vpMbtDistanceCylinder::updateMovingEdge(), vpMbtDistanceLine::updateMovingEdge(), and vpRectOriented::vpRectOriented().

◆ get_j()

double vpImagePoint::get_j ( ) const
inline

Gets the point coordinate corresponding to the $ j $ axes in the frame (i,j).

Returns
The value of the coordinate along the $ j $ axes.
See also
get_i(), get_u(), get_v()
Examples
testAprilTag.cpp, testImageDraw.cpp, tutorial-flood-fill.cpp, and tutorial-hsv-range-tuner.cpp.

Definition at line 125 of file vpImagePoint.h.

Referenced by vpNurbs::computeCurveDersPoint(), vpImageTools::crop(), vpDisplayGTK::displayArrow(), vpDisplayOpenCV::displayArrow(), vpDisplayX::displayArrow(), vpDisplayGTK::displayCross(), vpDisplayOpenCV::displayCross(), vpDisplayX::displayCross(), vpDisplayOpenCV::displayDotLine(), vpDisplayGTK::displayImageROI(), vpDisplayOpenCV::displayImageROI(), vpDisplay::displayLine(), vpKeyPoint::displayMatching(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpDisplayWin32::displayRectangle(), distance(), vpImageDraw::drawArrow(), vpImageDraw::drawCross(), vpImageDraw::drawDottedLine(), vpImageTools::extract(), vp::findContours(), vp::floodFill(), vpMbtDistanceKltCylinder::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getFeaturesForDisplay(), vpMbtFaceDepthNormal::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getModelForDisplay(), vpMbtDistanceKltCylinder::getModelForDisplay(), vpMbtDistanceCircle::getModelForDisplay(), vpMbtDistanceCylinder::getModelForDisplay(), vpMbtDistanceLine::getModelForDisplay(), vpPolygon3D::getNbCornerInsideImage(), vpImage< Type >::getValue(), vpMbtDistanceCylinder::initMovingEdge(), vpMbtDistanceLine::initMovingEdge(), vpDot::initTracking(), vpMeLine::initTracking(), vpDot2::initTracking(), inSegment(), vpImage< Type >::insert(), vpImageTools::interpolate(), vpTemplateTrackerTriangle::inTriangle(), vpTriangle::inTriangle(), vpRect::isInside(), vpPolygon::isInside(), vpMeEllipse::leastSquareRobust(), vpWireFrameSimulator::navigation(), nextInSegment(), vpImage< Type >::operator()(), vpRectOriented::operator=(), vpMeTracker::outOfImage(), vpMeEllipse::plugHoles(), vpNurbs::removeCurveKnot(), vpMeEllipse::sample(), vpMeLine::sample(), vpMeNurbs::seekExtremitiesCanny(), vpRectOriented::setOrientation(), vpRectOriented::setPoints(), vpRectOriented::setSize(), sqrDistance(), vpMbtDistanceCylinder::updateMovingEdge(), vpMbtDistanceLine::updateMovingEdge(), and vpRectOriented::vpRectOriented().

◆ get_u()

double vpImagePoint::get_u ( ) const
inline

Gets the point coordinate corresponding to the $ u $ axes in the frame (u,v).

Returns
The value of the coordinate along the $ u $ axes.
See also
get_i(), get_j(), get_v()
Examples
servoAfma4Point2DCamVelocityKalman.cpp, testConvert.cpp, testImageDraw.cpp, testRealSense2_D435_align.cpp, testRealSense2_D435_opencv.cpp, trackDot.cpp, trackDot2.cpp, trackDot2WithAutoDetection.cpp, tutorial-flood-fill.cpp, tutorial-klt-tracker-live-v4l2.cpp, and tutorial-klt-tracker.cpp.

Definition at line 136 of file vpImagePoint.h.

Referenced by vpMeEllipse::computeAngleOnEllipse(), vpImageCircle::computeAngularCoverageInRoI(), vpImageCircle::computePixelsInMask(), vpPose::computePlanarObjectPoseFromRGBD(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpMeEllipse::computeTheta(), vpPixelMeterConversion::convertPoint(), vpDot2::defineDots(), vpDisplayOpenCV::displayCircle(), vpCalibration::displayData(), vpDisplayOpenCV::displayLine(), vpDisplayOpenCV::displayPoint(), vpDisplayGTK::displayRectangle(), vpDisplayX::displayRectangle(), vpDisplayOpenCV::displayRectangle(), vpDisplayOpenCV::displayText(), vpImageDraw::drawEllipse(), vpImageDraw::drawLine(), vpDisplayWin32::flushDisplayROI(), vpDot2::getDistance(), vpTemplateTrackerTriangle::init(), vpPolygon::isInside(), vpMath::lineFitting(), vpRect::moveCenter(), vpHomography::project(), vpColorDepthConversion::projectColorToDepth(), vpHomography::projection(), vpDot2::searchDotsInArea(), vpRect::set(), vpRect::setBottomRight(), vpRect::setTopLeft(), vpDot::track(), vpDot2::track(), vpRect::vpRect(), vpTemplateTrackerTriangle::vpTemplateTrackerTriangle(), and vpCalibration::writeData().

◆ get_v()

double vpImagePoint::get_v ( ) const
inline

Gets the point coordinate corresponding to the $ v $ axes in the frame (u,v).

Returns
The value of the coordinate along the $ v $ axes.
See also
get_i(), get_j(), get_u()
Examples
servoAfma4Point2DCamVelocityKalman.cpp, testConvert.cpp, testImageDraw.cpp, testRealSense2_D435_align.cpp, testRealSense2_D435_opencv.cpp, trackDot.cpp, trackDot2.cpp, trackDot2WithAutoDetection.cpp, tutorial-flood-fill.cpp, tutorial-klt-tracker-live-v4l2.cpp, and tutorial-klt-tracker.cpp.

Definition at line 147 of file vpImagePoint.h.

Referenced by vpMeEllipse::computeAngleOnEllipse(), vpImageCircle::computeAngularCoverageInRoI(), vpImageCircle::computePixelsInMask(), vpPose::computePlanarObjectPoseFromRGBD(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpMeEllipse::computeTheta(), vpPixelMeterConversion::convertPoint(), vpDot2::defineDots(), vpDisplayOpenCV::displayCircle(), vpCalibration::displayData(), vpDisplayOpenCV::displayLine(), vpDisplayOpenCV::displayPoint(), vpDisplayGTK::displayRectangle(), vpDisplayX::displayRectangle(), vpDisplayOpenCV::displayRectangle(), vpDisplayOpenCV::displayText(), vpImageDraw::drawEllipse(), vpImageDraw::drawLine(), vpDisplayWin32::flushDisplayROI(), vpDot2::getDistance(), vpTemplateTrackerTriangle::init(), vpPolygon::isInside(), vpMath::lineFitting(), vpRect::moveCenter(), vpHomography::project(), vpColorDepthConversion::projectColorToDepth(), vpHomography::projection(), vpDot2::searchDotsInArea(), vpRect::set(), vpRect::setBottomRight(), vpRect::setTopLeft(), vpDot::track(), vpDot2::track(), vpRect::vpRect(), vpTemplateTrackerTriangle::vpTemplateTrackerTriangle(), and vpCalibration::writeData().

◆ getBBox()

vpRect vpImagePoint::getBBox ( const std::vector< vpImagePoint > &  ipVec)
static

Computes and returns the bounding box.

Parameters
ipVec: Vector of input image points.
Returns
Bounding box of the points.

Definition at line 422 of file vpImagePoint.cpp.

◆ inRectangle()

bool vpImagePoint::inRectangle ( const vpRect rect) const

Check if an image point belongs to a rectangle.

Parameters
rect: the rectangle.
Returns
Returns true if the point belongs to the rectangle.

Definition at line 49 of file vpImagePoint.cpp.

References vpRect::getBottom(), vpRect::getLeft(), vpRect::getRight(), and vpRect::getTop().

Referenced by vpPlot::navigate().

◆ inSegment()

bool vpImagePoint::inSegment ( const vpImagePoint start,
const vpImagePoint end 
) const
inline

Test if the image point belongs to a segment represented by two image points.

Parameters
[in]start: Segment start image point.
[in]end: Segment end image point.
Returns
True if current image point belongs to the segment. False otherwise.

To see how to use this function, a code snippet is given in nextInSegment().

See also
nextInSegment()

Definition at line 162 of file vpImagePoint.h.

References get_i(), and get_j().

Referenced by vpColorDepthConversion::projectColorToDepth().

◆ nextInSegment()

vpImagePoint vpImagePoint::nextInSegment ( const vpImagePoint start,
const vpImagePoint end 
) const
inline

Considering current image point, returns the next image point that belongs to the segment [start,end].

Parameters
[in]start: Segment start image point.
[in]end: Segment end image point.
Returns
Regarding current image point, next image point that belongs to the liSegmentne [start,end].

The following sample code shows how to use this function to find all the pixels that belong to the segment defined by 2 image points with coordinates [10,12] and [20,16]:

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint start_pixel(10, 12);
vpImagePoint end_pixel(20, 16);
for (auto curr_pixel = start_pixel; curr_pixel.inSegment(start_pixel, end_pixel);
curr_pixel = curr_pixel.nextInSegment(start_pixel, end_pixel)) {
std::cout << "pixel: " << curr_pixel << std::endl;
if (curr_pixel == end_pixel) break;
}
return EXIT_SUCCESS;
}
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82

It produces the following output by printing all the pixels belonging to the segment:

pixel: 10, 12
pixel: 11, 12.4
pixel: 12, 12.8
pixel: 13, 13.2
pixel: 14, 13.6
pixel: 15, 14
pixel: 16, 14.4
pixel: 17, 14.8
pixel: 18, 15.2
pixel: 19, 15.6
pixel: 20, 16
See also
inSegment()

Definition at line 215 of file vpImagePoint.h.

References get_i(), and get_j().

Referenced by vpColorDepthConversion::projectColorToDepth().

◆ operator*=()

vpImagePoint& vpImagePoint::operator*= ( double  scale)
inline

Operator *=.

Definition at line 277 of file vpImagePoint.h.

◆ operator+=()

vpImagePoint & vpImagePoint::operator+= ( const vpImagePoint ip)

Operator +=.

This operator can be used to compute the center of gravity of a set of image points.

#include <iostream>
#include <vector>
#include <visp3/core/vpImagePoint.h>
int main()
{
std::vector<vpImagePoint> ip(2);
ip[0].set_ij(100, 200);
ip[1].set_ij(300, 400);
vpImagePoint cog(0,0);
for(unsigned int i=0; i<ip.size(); ++i)
cog += ip[i];
cog /= ip.size();
std::cout << "cog: " << cog << std::endl;
}

Definition at line 82 of file vpImagePoint.cpp.

◆ operator-=()

vpImagePoint& vpImagePoint::operator-= ( const vpImagePoint ip)
inline

Operator -=.

Definition at line 265 of file vpImagePoint.h.

◆ operator/=()

vpImagePoint & vpImagePoint::operator/= ( double  scale)

Operator /=.

This operator can be used to compute the center of gravity of a set of image points.

#include <iostream>
#include <vector>
#include <visp3/core/vpImagePoint.h>
int main()
{
std::vector<vpImagePoint> ip(2);
ip[0].set_ij(100, 200);
ip[1].set_ij(300, 400);
vpImagePoint cog(0,0);
for(unsigned int i=0; i<ip.size(); ++i)
cog += ip[i];
cog /= ip.size();
std::cout << "cog: " << cog << std::endl;
}

Definition at line 115 of file vpImagePoint.cpp.

◆ operator=()

vpImagePoint& vpImagePoint::operator= ( const vpImagePoint ip)
inline

Copy operator.

Definition at line 239 of file vpImagePoint.h.

◆ set_i()

void vpImagePoint::set_i ( double  ii)
inline

Sets the point coordinate corresponding to the $ i $ axes in the frame (i,j).

Parameters
ii: The desired value for the coordinate along the $ i $ axes.
See also
set_j(), set_u(), set_v()
Examples
AROgre.cpp, AROgreBasic.cpp, SickLDMRS-Process.cpp, displayD3D.cpp, displayGTK.cpp, displayOpenCV.cpp, displayX.cpp, displayXMulti.cpp, manDisplay.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, testDisplays.cpp, testImageDraw.cpp, testImagePoint.cpp, testTrackDot.cpp, and trackMeLine.cpp.

Definition at line 293 of file vpImagePoint.h.

Referenced by vpBSpline::computeCurveDers(), vpNurbs::computeCurveDersPoint(), vpBSpline::computeCurvePoint(), vpNurbs::computeCurvePoint(), vpMeLine::computeRhoTheta(), vpDisplayGTK::displayArrow(), vpDisplayOpenCV::displayArrow(), vpDisplayX::displayArrow(), vpDisplayGTK::displayCross(), vpDisplayOpenCV::displayCross(), vpDisplayX::displayCross(), vpMeLine::displayLine(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpDisplayWin32::displayRectangle(), vpImageDraw::drawArrow(), vpImageDraw::drawCross(), vpMeLine::getExtremities(), vpMbtDistanceKltCylinder::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getFeaturesForDisplay(), vpMeSite::getQueryList(), vpMeLine::intersection(), vpPolygon::isInside(), vpRectOriented::operator=(), vpNurbs::refineKnotVectCurve(), vpNurbs::removeCurveKnot(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpImageSimulator::setCameraPosition(), vpRectOriented::setOrientation(), vpRectOriented::setPoints(), vpRectOriented::setSize(), vpMeSite::track(), vpPolygon::updateCenter(), and vpRectOriented::vpRectOriented().

◆ set_ij()

◆ set_j()

void vpImagePoint::set_j ( double  jj)
inline

Sets the point coordinate corresponding to the $ j $ axes in the frame (i,j).

Parameters
jj: The desired value for the coordinate along the $ j $ axes.
See also
set_i(), set_u(), set_v()
Examples
AROgre.cpp, AROgreBasic.cpp, SickLDMRS-Process.cpp, displayD3D.cpp, displayGTK.cpp, displayOpenCV.cpp, displayX.cpp, displayXMulti.cpp, manDisplay.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, testDisplays.cpp, testImageDraw.cpp, testImagePoint.cpp, testTrackDot.cpp, and trackMeLine.cpp.

Definition at line 304 of file vpImagePoint.h.

Referenced by vpBSpline::computeCurveDers(), vpNurbs::computeCurveDersPoint(), vpBSpline::computeCurvePoint(), vpNurbs::computeCurvePoint(), vpMeLine::computeRhoTheta(), vpDisplayGTK::displayArrow(), vpDisplayOpenCV::displayArrow(), vpDisplayX::displayArrow(), vpDisplayGTK::displayCross(), vpDisplayOpenCV::displayCross(), vpDisplayX::displayCross(), vpMeLine::displayLine(), vpMbtDistanceKltCylinder::displayPrimitive(), vpMbtDistanceKltPoints::displayPrimitive(), vpDisplayWin32::displayRectangle(), vpImageDraw::drawArrow(), vpImageDraw::drawCross(), vp::findContours(), vpMeLine::getExtremities(), vpMbtDistanceKltCylinder::getFeaturesForDisplay(), vpMbtDistanceKltPoints::getFeaturesForDisplay(), vpMeSite::getQueryList(), vpMeLine::intersection(), vpPolygon::isInside(), vpRectOriented::operator=(), vpNurbs::removeCurveKnot(), vpMeLine::sample(), vpMeLine::seekExtremities(), vpImageSimulator::setCameraPosition(), vpRectOriented::setOrientation(), vpRectOriented::setPoints(), vpRectOriented::setSize(), vpMeSite::track(), vpPolygon::updateCenter(), and vpRectOriented::vpRectOriented().

◆ set_u()

◆ set_uv()

void vpImagePoint::set_uv ( double  u,
double  v 
)
inline

Sets the point coordinates in the frame (u,v).

Parameters
u: The desired value for the coordinate along the $ u $ axes.
v: The desired value for the coordinate along the $ v $ axes.
See also
set_i(), set_j(), set_u(), set_v()
Examples
testKeyPoint-5.cpp, testKeyPoint-6.cpp, and tutorial-flood-fill.cpp.

Definition at line 352 of file vpImagePoint.h.

Referenced by vpMeEllipse::computePointOnEllipse(), vpDot2::defineDots(), vpImageDraw::drawEllipse(), vpTemplateTrackerZone::getCenter(), vpTemplateTrackerTriangle::getCorners(), vpMeEllipse::getParameters(), vpMeEllipse::initTracking(), and vpMeEllipse::leastSquareRobust().

◆ set_v()

◆ sqrDistance()

double vpImagePoint::sqrDistance ( const vpImagePoint iP1,
const vpImagePoint iP2 
)
static

Compute the distance $ |iP1 - iP2| = (i_1-i_2)^2+(j_1-j_2)^2 $

Parameters
iP1: First point
iP2: Second point
Returns
the distance between the two points.

Definition at line 450 of file vpImagePoint.cpp.

References get_i(), get_j(), and vpMath::sqr().

Referenced by vpMeNurbs::localReSample(), and vpMeNurbs::sample().

Friends And Related Function Documentation

◆ operator!= [1/2]

VISP_EXPORT bool operator!= ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
friend

Returns true if ip1 and ip2 are different; otherwire returns true.

Definition at line 145 of file vpImagePoint.cpp.

◆ operator!=() [2/2]

VISP_EXPORT bool operator!= ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
related

Returns true if ip1 and ip2 are different; otherwire returns true.

Definition at line 145 of file vpImagePoint.cpp.

◆ operator* [1/2]

VISP_EXPORT vpImagePoint operator* ( const vpImagePoint ip1,
double  scale 
)
friend

Returns a vpImagePoint with coordinates multiplied by a scale factor.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip*2: " << ip*2 << std::endl; // new coordinates (200, 400)
return 0;
}

Definition at line 351 of file vpImagePoint.cpp.

◆ operator*() [2/2]

VISP_EXPORT vpImagePoint operator* ( const vpImagePoint ip1,
double  scale 
)
related

Returns a vpImagePoint with coordinates multiplied by a scale factor.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip*2: " << ip*2 << std::endl; // new coordinates (200, 400)
return 0;
}

Definition at line 351 of file vpImagePoint.cpp.

◆ operator+ [1/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
friend

Returns a vpImagePoint wich is the sum of $ ip1 $ and $ ip2 $.

Definition at line 162 of file vpImagePoint.cpp.

◆ operator+() [2/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
related

Returns a vpImagePoint wich is the sum of $ ip1 $ and $ ip2 $.

Definition at line 162 of file vpImagePoint.cpp.

◆ operator+ [3/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
double  offset 
)
friend

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+12.34: " << ip+12.34 << std::endl; // new coordinates (112.34, 212.34)
return 0;
}

Definition at line 244 of file vpImagePoint.cpp.

◆ operator+() [4/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
double  offset 
)
related

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+12.34: " << ip+12.34 << std::endl; // new coordinates (112.34, 212.34)
return 0;
}

Definition at line 244 of file vpImagePoint.cpp.

◆ operator+ [5/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
int  offset 
)
friend

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+10: " << ip+10 << std::endl; // new coordinates (110, 210)
return 0;
}

Definition at line 196 of file vpImagePoint.cpp.

◆ operator+() [6/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
int  offset 
)
related

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+10: " << ip+10 << std::endl; // new coordinates (110, 210)
return 0;
}

Definition at line 196 of file vpImagePoint.cpp.

◆ operator+ [7/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
unsigned int  offset 
)
friend

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+10u: " << ip+10u << std::endl; // new coordinates (110, 210)
return 0;
}

Definition at line 220 of file vpImagePoint.cpp.

◆ operator+() [8/8]

VISP_EXPORT vpImagePoint operator+ ( const vpImagePoint ip1,
unsigned int  offset 
)
related

Returns a vpImagePoint with an offset added to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip+10u: " << ip+10u << std::endl; // new coordinates (110, 210)
return 0;
}

Definition at line 220 of file vpImagePoint.cpp.

◆ operator+= [1/2]

VISP_EXPORT vpImagePoint operator+= ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
friend

Returns a vpImagePoint wich is the sum of $ ip1 $ and $ ip2 $.

Definition at line 172 of file vpImagePoint.cpp.

◆ operator+=() [2/2]

VISP_EXPORT vpImagePoint operator+= ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
related

Returns a vpImagePoint wich is the sum of $ ip1 $ and $ ip2 $.

Definition at line 172 of file vpImagePoint.cpp.

◆ operator- [1/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
friend

Returns a vpImagePoint wich is the difference between $ ip1 $ and $ ip2 $.

Definition at line 255 of file vpImagePoint.cpp.

◆ operator-() [2/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
related

Returns a vpImagePoint wich is the difference between $ ip1 $ and $ ip2 $.

Definition at line 255 of file vpImagePoint.cpp.

◆ operator- [3/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
double  offset 
)
friend

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-12.34: " << ip-12.34 << std::endl; // new coordinates (87.66, 187.66)
return 0;
}

Definition at line 327 of file vpImagePoint.cpp.

◆ operator-() [4/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
double  offset 
)
related

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-12.34: " << ip-12.34 << std::endl; // new coordinates (87.66, 187.66)
return 0;
}

Definition at line 327 of file vpImagePoint.cpp.

◆ operator- [5/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
int  offset 
)
friend

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-10: " << ip-10 << std::endl; // new coordinates (90, 190)
return 0;
}

Definition at line 279 of file vpImagePoint.cpp.

◆ operator-() [6/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
int  offset 
)
related

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-10: " << ip-10 << std::endl; // new coordinates (90, 190)
return 0;
}

Definition at line 279 of file vpImagePoint.cpp.

◆ operator- [7/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
unsigned int  offset 
)
friend

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-10u: " << ip-10u << std::endl; // new coordinates (90, 190)
return 0;
}

Definition at line 303 of file vpImagePoint.cpp.

◆ operator-() [8/8]

VISP_EXPORT vpImagePoint operator- ( const vpImagePoint ip1,
unsigned int  offset 
)
related

Returns a vpImagePoint with an offset subtracted to the two coordinates.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip-10u: " << ip-10u << std::endl; // new coordinates (90, 190)
return 0;
}

Definition at line 303 of file vpImagePoint.cpp.

◆ operator/ [1/2]

VISP_EXPORT vpImagePoint operator/ ( const vpImagePoint ip1,
double  scale 
)
friend

Returns a vpImagePoint with coordinates divided by a scale factor.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip/2: " << ip/2 << std::endl; // new coordinates (50, 100)
return 0;
}

Definition at line 375 of file vpImagePoint.cpp.

◆ operator/() [2/2]

VISP_EXPORT vpImagePoint operator/ ( const vpImagePoint ip1,
double  scale 
)
related

Returns a vpImagePoint with coordinates divided by a scale factor.

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
vpImagePoint ip(100, 200); // Create an image point with coordinates i=100, j=200
std::cout << "ip: " << ip << std::endl; // coordinates (100, 200)
std::cout << "ip/2: " << ip/2 << std::endl; // new coordinates (50, 100)
return 0;
}

Definition at line 375 of file vpImagePoint.cpp.

◆ operator<< [1/2]

VISP_EXPORT std::ostream & operator<< ( std::ostream &  os,
const vpImagePoint ip 
)
friend

Writes the image point coordinates ip to the stream os, and returns a reference to the stream. Writes the first coordinate along the i axis and then the second one along the j axis. The coordinates are separated by a comma.

The following code

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
ip.set_i(10);
ip.set_j(11.1);
std::cout << "Image point with coordinates: " << ip << std::endl;
return 0;
}
void set_j(double jj)
Definition: vpImagePoint.h:304
void set_i(double ii)
Definition: vpImagePoint.h:293

produces the output:

Image point with coordinates: 10, 11.1

Definition at line 411 of file vpImagePoint.cpp.

◆ operator<<() [2/2]

VISP_EXPORT std::ostream & operator<< ( std::ostream &  os,
const vpImagePoint ip 
)
related

Writes the image point coordinates ip to the stream os, and returns a reference to the stream. Writes the first coordinate along the i axis and then the second one along the j axis. The coordinates are separated by a comma.

The following code

#include <iostream>
#include <visp3/core/vpImagePoint.h>
int main()
{
ip.set_i(10);
ip.set_j(11.1);
std::cout << "Image point with coordinates: " << ip << std::endl;
return 0;
}

produces the output:

Image point with coordinates: 10, 11.1

Definition at line 411 of file vpImagePoint.cpp.

◆ operator== [1/2]

VISP_EXPORT bool operator== ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
friend

Returns true if ip1 and ip2 are equal; otherwire returns false.

Definition at line 127 of file vpImagePoint.cpp.

◆ operator==() [2/2]

VISP_EXPORT bool operator== ( const vpImagePoint ip1,
const vpImagePoint ip2 
)
related

Returns true if ip1 and ip2 are equal; otherwire returns false.

Definition at line 127 of file vpImagePoint.cpp.