/usr/include/visp/vpImagePoint.h is in libvisp-dev 2.9.0-3+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /****************************************************************************
*
* $Id: vpImagePoint.h 4649 2014-02-07 14:57:11Z fspindle $
*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.txt at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using ViSP with software that can not be combined with the GNU
* GPL, please contact INRIA about acquiring a ViSP Professional
* Edition License.
*
* See http://www.irisa.fr/lagadic/visp/visp.html for more information.
*
* This software was developed at:
* INRIA Rennes - Bretagne Atlantique
* Campus Universitaire de Beaulieu
* 35042 Rennes Cedex
* France
* http://www.irisa.fr/lagadic
*
* If you have questions regarding the use of this file, please contact
* INRIA at visp@inria.fr
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Description:
* 2D point useful for image processing
*
* Authors:
* Nicolas Melchior
* Fabien Spindler
*
*****************************************************************************/
#ifndef vpImagePoint_H
#define vpImagePoint_H
/*!
\file vpImagePoint.h
\brief Class that defines a 2D point in an image. This class is useful
for image processing
*/
#include <visp/vpConfig.h>
#include <visp/vpMath.h>
#include <ostream>
#include <cmath> // std::fabs
#include <limits> // numeric_limits
class vpHomography;
class vpRect;
/*!
\class vpImagePoint
\ingroup ImageTool
\brief Class that defines a 2D point in an image. This class is
useful for image processing and stores only the <B>2D coordinates
given in sub-pixel</B>.
\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.
\image html vpImagePoint.gif
\image latex vpImagePoint.ps width=10cm
\warning <B>An instance of the vpImagePoint class corresponds to a
particular point. Thus, if you change the point coordinate using the
method set_i(const double i), it produces the same effect than if
you used the method set_v(const double v). These two methods change
the same private attribute. It is also true for the two methods
set_j(const double j) and set_u(const double u).</B>
*/
class VISP_EXPORT vpImagePoint
{
public:
/*!
Default constructor that initialize the coordinates of the image
point to zero.
*/
inline vpImagePoint() : i(0), j(0) {}
/*!
Default constructor that initialize the coordinates of the image
thanks to the parameters \f$ ii \f$ and \f$ jj \f$.
*/
inline vpImagePoint(double ii, double jj) : i(ii), j(jj) {}
/*!
Copy constructor.
Initialize the coordinates of the image point with \e ip.
\param ip : An image point.
*/
inline vpImagePoint(const vpImagePoint &ip) : i(ip.i), j(ip.j) {}
//! Destructor.
inline virtual ~vpImagePoint() { ; }
/*!
Copy operator.
*/
inline const vpImagePoint& operator=(const vpImagePoint &ip) {
this->i = ip.i;
this->j = ip.j;
return *this;
}
vpImagePoint& operator+=(const vpImagePoint &ip);
/*!
Operator -=.
*/
inline vpImagePoint& operator-=(const vpImagePoint &ip) {
this->i -= ip.i;
this->j -= ip.j;
return *this;
}
vpImagePoint& operator/=(const double scale);
/*!
Operator *=.
*/
inline vpImagePoint& operator*=(const double scale) {
this->i *= scale;
this->j *= scale;
return *this;
}
/*!
Sets the point coordinate corresponding to the \f$ i \f$ axes in
the frame (i,j).
\param ii : The desired value for the coordinate along the \f$ i \f$ axes.
\sa set_j(), set_u(), set_v()
*/
inline void set_i(const double ii) { this->i = ii ; }
/*!
Sets the point coordinate corresponding to the \f$ j \f$ axes in
the frame (i,j).
\param jj : The desired value for the coordinate along the \f$ j \f$ axes.
\sa set_i(), set_u(), set_v()
*/
inline void set_j(const double jj) { this->j = jj ; }
/*!
Sets the point coordinates in the frame (i,j).
\param ii : The desired value for the coordinate along the \f$ i \f$ axes.
\param jj : The desired value for the coordinate along the \f$ j \f$ axes.
\sa set_i(), set_j(), set_u(), set_v()
*/
inline void set_ij(const double ii, const double jj) {
this->i = ii ;
this->j = jj ;
}
/*!
Gets the point coordinate corresponding to the \f$ i \f$ axes in
the frame (i,j).
\return The value of the coordinate along the \f$ i \f$ axes.
\sa get_j(), get_u(), get_v()
*/
inline double get_i() const { return i ; }
/*!
Gets the point coordinate corresponding to the \f$ j \f$ axes in
the frame (i,j).
\return The value of the coordinate along the \f$ j \f$ axes.
\sa get_i(), get_u(), get_v()
*/
inline double get_j() const { return j ; }
/*!
Sets the point coordinate corresponding to the \f$ u \f$ axes in
the frame (u,v).
\param u : The desired value for the coordinate along the \f$ u \f$ axes.
\sa set_i(), set_j(), set_v()
*/
inline void set_u(const double u) { j = u ; }
/*!
Sets the point coordinate corresponding to the \f$ v \f$ axes in
the frame (u,v).
\param v : The desired value for the coordinate along the \f$ v \f$ axes.
\sa set_i(), set_j(), set_u()
*/
inline void set_v(const double v) { i = v ; }
/*!
Sets the point coordinates in the frame (u,v).
\param u : The desired value for the coordinate along the \f$ u \f$ axes.
\param v : The desired value for the coordinate along the \f$ v \f$ axes.
\sa set_i(), set_j(), set_u(), set_v()
*/
inline void set_uv(const double u, const double v) {
this->i = v ;
this->j = u ;
}
/*!
Gets the point coordinate corresponding to the \f$ u \f$ axes in
the frame (u,v).
\return The value of the coordinate along the \f$ u \f$ axes.
\sa get_i(), get_j(), get_v()
*/
inline double get_u() const { return j ; }
/*!
Gets the point coordinate corresponding to the \f$ v \f$ axes in
the frame (u,v).
\return The value of the coordinate along the \f$ v \f$ axes.
\sa get_i(), get_j(), get_u()
*/
inline double get_v() const { return i; }
/*!
Compute the distance \f$ |iP1 - iP2| = \sqrt{(i_1-i_2)^2+(j_1-j_2)^2} \f$
\param iP1 : First point
\param iP2 : Second point
\return the distance between the two points.
*/
static double distance (const vpImagePoint &iP1, const vpImagePoint &iP2) {
return(sqrt(vpMath::sqr(iP1.get_i()-iP2.get_i())+vpMath::sqr(iP1.get_j()-iP2.get_j())));}
/*!
Compute the distance \f$ |iP1 - iP2| = (i_1-i_2)^2+(j_1-j_2)^2 \f$
\param iP1 : First point
\param iP2 : Second point
\return the distance between the two points.
*/
static double sqrDistance (const vpImagePoint &iP1, const vpImagePoint &iP2) {
return(vpMath::sqr(iP1.get_i()-iP2.get_i())+vpMath::sqr(iP1.get_j()-iP2.get_j()));}
bool inRectangle( const vpRect &rect ) const;
friend VISP_EXPORT bool operator==( const vpImagePoint &ip1, const vpImagePoint &ip2 );
friend VISP_EXPORT bool operator!=( const vpImagePoint &ip1, const vpImagePoint &ip2 );
friend VISP_EXPORT vpImagePoint operator+=( const vpImagePoint &ip1, const vpImagePoint &ip2 );
friend VISP_EXPORT vpImagePoint operator+( const vpImagePoint &ip1, const vpImagePoint &ip2 );
friend VISP_EXPORT vpImagePoint operator+( const vpImagePoint &ip1, const int offset );
friend VISP_EXPORT vpImagePoint operator+( const vpImagePoint &ip1, const double offset );
friend VISP_EXPORT vpImagePoint operator-( const vpImagePoint &ip1, const vpImagePoint &ip2 );
friend VISP_EXPORT vpImagePoint operator-( const vpImagePoint &ip1, const int offset );
friend VISP_EXPORT vpImagePoint operator-( const vpImagePoint &ip1, const double offset );
friend VISP_EXPORT vpImagePoint operator*( const vpImagePoint &ip1, const double scale );
friend VISP_EXPORT vpImagePoint operator/( const vpImagePoint &ip1, const double scale );
friend VISP_EXPORT std::ostream& operator<< (std::ostream &os, const vpImagePoint& ip);
vpImagePoint projection(const vpHomography& aHb);
private:
double i,j;
};
#endif
|