本文整理汇总了C++中vpImagePoint::get_i方法的典型用法代码示例。如果您正苦于以下问题:C++ vpImagePoint::get_i方法的具体用法?C++ vpImagePoint::get_i怎么用?C++ vpImagePoint::get_i使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vpImagePoint
的用法示例。
在下文中一共展示了vpImagePoint::get_i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uv
void
vpTriangle::init(const vpImagePoint &iP1, const vpImagePoint &iP2, const vpImagePoint &iP3)
{
apex1 = iP1;
apex2 = iP2;
apex3 = iP3;
vpMatrix uv(2,2);
vpMatrix uvinv(2,2);
uv[0][0] = iP2.get_i() - iP1.get_i();
uv[1][0] = iP3.get_i() - iP1.get_i();
uv[0][1] = iP2.get_j() - iP1.get_j();
uv[1][1] = iP3.get_j() - iP1.get_j();
try
{
uvinv=uv.inverseByLU();
goodTriange = true;
}
catch(...)
{
goodTriange = false;
std::cout<<"Empty triangle"<<std::endl;
}
uvinv00=uvinv[0][0];
uvinv01=uvinv[0][1];
uvinv10=uvinv[1][0];
uvinv11=uvinv[1][1];
S1 = iP1;
}
示例2: defined
void
vpPlotCurve::plotPoint(const vpImage<unsigned char> &I, const vpImagePoint &iP, const double x, const double y)
{
nbPoint++;
if (nbPoint > 1)
{
vpDisplay::displayLine(I,lastPoint, iP, color, thickness);
}
#if defined (VISP_HAVE_DISPLAY)
double top;
double left;
double width;
double height;
if (iP.get_i() <= lastPoint.get_i()) {top = iP.get_i()-5; height = lastPoint.get_i() - top+10;}
else {top = lastPoint.get_i()-5; height = iP.get_i() - top+10;}
if (iP.get_j() <= lastPoint.get_j()) {left = iP.get_j()-5; width = lastPoint.get_j() - left+10;}
else {left = lastPoint.get_j()-5; width = iP.get_j() - left+10;}
vpDisplay::flushROI(I,vpRect(left,top,width,height));
#endif
lastPoint = iP;
pointListx.push_back(x);
pointListy.push_back(y);
pointListz.push_back(0.0);
}
示例3: matchPoint
/*!
Computes the SURF points in only a part of the current image I and
try to matched them with the points in the reference list. The part
of the image is a rectangle defined by its top left corner, its
height and its width. The parameters of this rectangle must be given
in pixel. Only the matched points are stored.
\param I : The gray scaled image where the points are computed.
\param iP : The top left corner of the rectangle.
\param height : height of the rectangle (in pixel).
\param width : width of the rectangle (in pixel).
\return the number of point which have been matched.
*/
unsigned int vpKeyPointSurf::matchPoint(const vpImage<unsigned char> &I,
const vpImagePoint &iP,
const unsigned int height, const unsigned int width)
{
if((iP.get_i()+height) >= I.getHeight()
|| (iP.get_j()+width) >= I.getWidth())
{
vpTRACE("Bad size for the subimage");
throw(vpException(vpImageException::notInTheImage ,
"Bad size for the subimage"));
}
vpImage<unsigned char> subImage;
vpImageTools::createSubImage(I,
(unsigned int)iP.get_i(),
(unsigned int)iP.get_j(),
height, width, subImage);
unsigned int nbMatchedPoint = this->matchPoint(subImage);
for(unsigned int k = 0; k < nbMatchedPoint; k++)
{
(currentImagePointsList[k]).set_i((currentImagePointsList[k]).get_i()
+ iP.get_i());
(currentImagePointsList[k]).set_j((currentImagePointsList[k]).get_j()
+ iP.get_j());
}
return(nbMatchedPoint);
}
示例4: distance
/*
Compute the distance d = |Pw1-Pw2|
*/
inline double distance(const vpImagePoint &iP1, const double w1, const vpImagePoint &iP2, const double w2)
{
double distancei = iP1.get_i() - iP2.get_i();
double distancej = iP1.get_j() - iP2.get_j();
double distancew = w1 -w2;
return sqrt(vpMath::sqr(distancei)+vpMath::sqr(distancej)+vpMath::sqr(distancew));
}
示例5: fromTo
bool fromTo(const vpImagePoint &from, const vpImagePoint &to, vpDirection &direction) {
if (from == to) {
return false;
}
if ( std::fabs(from.get_i() - to.get_i()) < std::numeric_limits<double>::epsilon() ) {
if (from.get_j() < to.get_j()) {
direction.m_direction = EAST;
} else {
direction.m_direction = WEST;
}
} else if (from.get_i() < to.get_i()) {
if ( std::fabs(from.get_j() - to.get_j()) < std::numeric_limits<double>::epsilon() ) {
direction.m_direction = SOUTH;
} else if (from.get_j() < to.get_j()) {
direction.m_direction = SOUTH_EAST;
} else {
direction.m_direction = SOUTH_WEST;
}
} else {
if ( std::fabs(from.get_j() - to.get_j()) < std::numeric_limits<double>::epsilon() ) {
direction.m_direction = NORTH;
} else if (from.get_j() < to.get_j()) {
direction.m_direction = NORTH_EAST;
} else {
direction.m_direction = NORTH_WEST;
}
}
return true;
}
示例6:
void
vpPlotCurve::plotPoint(vpImage<unsigned char> &I, vpImagePoint iP, const double x, const double y)
{
pointListx.end();
pointListy.end();
pointListz.end();
nbPoint++;
if (nbPoint > 1)
{
vpDisplay::displayLine(I,lastPoint, iP, color);
}
#if( defined VISP_HAVE_X11 || defined VISP_HAVE_GDI )
double top;
double left;
double width;
double height;
if (iP.get_i() <= lastPoint.get_i()) {top = iP.get_i()-5; height = lastPoint.get_i() - top+10;}
else {top = lastPoint.get_i()-5; height = iP.get_i() - top+10;}
if (iP.get_j() <= lastPoint.get_j()) {left = iP.get_j()-5; width = lastPoint.get_j() - left+10;}
else {left = lastPoint.get_j()-5; width = iP.get_j() - left+10;}
vpDisplay::flushROI(I,vpRect(left,top,width,height));
#endif
lastPoint = iP;
pointListx.addRight(x);
pointListy.addRight(y);
pointListz.addRight(0.0);
}
示例7: if
/*!
Computes the \f$ alpha \f$ angle of the two points and store them into alpha1 for the smallest and alpha2 for the biggest.
\note this function is useful only during the initialization.
\param pt1 : First point whose \f$ alpha \f$ angle is computed.
\param pt2 : Second point whose \f$ alpha \f$ angle is computed.
*/
void
vpMeEllipse::computeAngle(vpImagePoint pt1, vpImagePoint pt2)
{
getParameters() ;
double j1, i1, j11, i11;
j1 = i1 = 0.0 ;
int number_of_points = 2000 ;
double incr = 2 * M_PI / number_of_points ; // angle increment
double dmin1 = 1e6 ;
double dmin2 = 1e6 ;
double k = 0 ;
while(k < 2*M_PI) {
// j1 = a *cos(k) ; // equation of an ellipse
// i1 = b *sin(k) ; // equation of an ellipse
j1 = a *sin(k) ; // equation of an ellipse
i1 = b *cos(k) ; // equation of an ellipse
// (i1,j1) are the coordinates on the origin centered ellipse ;
// a rotation by "e" and a translation by (xci,jc) are done
// to get the coordinates of the point on the shifted ellipse
// j11 = iPc.get_j() + ce *j1 - se *i1 ;
// i11 = iPc.get_i() -( se *j1 + ce *i1) ;
j11 = iPc.get_j() + ce *j1 + se *i1 ;
i11 = iPc.get_i() - se *j1 + ce *i1 ;
double d = vpMath::sqr(pt1.get_i()-i11) + vpMath::sqr(pt1.get_j()-j11) ;
if (d < dmin1)
{
dmin1 = d ;
alpha1 = k ;
}
d = vpMath::sqr(pt2.get_i()-i11) + vpMath::sqr(pt2.get_j()-j11) ;
if (d < dmin2)
{
dmin2 = d ;
alpha2 = k ;
}
k += incr ;
}
//std::cout << "end vpMeEllipse::computeAngle(..)" << alpha1 << " " << alpha2 << std::endl ;
if (alpha2 < alpha1)
alpha2 += 2 * M_PI;
//else if (alpha2 == alpha1)
else if (std::fabs(alpha2 - alpha1) < std::fabs(alpha1) * std::numeric_limits<double>::epsilon())
alpha2 += 2 * M_PI;
//std::cout << "end vpMeEllipse::computeAngle(..)" << alpha1 << " " << alpha2 << std::endl ;
}
示例8: displayImageROI
/*!
Display a selection of the gray level image \e I (8bits).
\warning Display has to be initialized.
\warning Suppress the overlay drawing in the region of interest.
\param I : Image to display.
\param iP : Top left corner of the region of interest
\param width : Width of the region of interest
\param height : Height of the region of interest
\sa init(), closeDisplay()
*/
void vpDisplayOpenCV::displayImageROI ( const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height )
{
if (displayHasBeenInitialized)
{
vpImage<unsigned char> Itemp;
vpImageTools::createSubImage(I,(unsigned int)iP.get_i(),(unsigned int)iP.get_j(),height,width,Itemp);
vpImage<vpRGBa> Ic;
vpImageConvert::convert(Itemp,Ic);
CvSize size = cvSize((int)this->width, (int)this->height);
int depth = 8;
int channels = 3;
if (background != NULL){
if(background->nChannels != channels || background->depth != depth
|| background->height != (int) I.getHeight() || background->width != (int) I.getWidth()){
if(background->nChannels != 0) cvReleaseImage(&background);
background = cvCreateImage( size, depth, channels );
}
}
else background = cvCreateImage( size, depth, channels );
IplImage* Ip = NULL;
vpImageConvert::convert(Ic, Ip);
unsigned char * input = (unsigned char*)Ip->imageData;
unsigned char * output = (unsigned char*)background->imageData;
unsigned int iwidth = Ic.getWidth();
input = input;
output = output + (int)(iP.get_i()*3*this->width+ iP.get_j()*3);
unsigned int i = 0;
while (i < height)
{
unsigned int j = 0;
while (j < width)
{
*(output+3*j) = *(input+j*3);
*(output+3*j+1) = *(input+j*3+1);
*(output+3*j+2) = *(input+j*3+2);
j++;
}
input = input + 3*iwidth;
output = output + 3*this->width;
i++;
}
cvReleaseImage(&Ip);
}
else
{
vpERROR_TRACE("openCV not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"OpenCV not initialized")) ;
}
}
示例9: displayArrow
/*!
Display an arrow from image point \e ip1 to image point \e ip2.
\param ip1,ip2 : Initial and final image point.
\param color : Arrow color.
\param w,h : Width and height of the arrow.
\param thickness : Thickness of the lines used to display the arrow.
*/
void vpDisplayGTK::displayArrow ( const vpImagePoint &ip1,
const vpImagePoint &ip2,
const vpColor &color,
unsigned int w, unsigned int h,
unsigned int thickness)
{
if (displayHasBeenInitialized)
{
try{
double a = ip2.get_i() - ip1.get_i() ;
double b = ip2.get_j() - ip1.get_j() ;
double lg = sqrt(vpMath::sqr(a)+vpMath::sqr(b)) ;
//if ((a==0)&&(b==0))
if ((std::fabs(a) <= std::numeric_limits<double>::epsilon() )&&(std::fabs(b) <= std::numeric_limits<double>::epsilon()) )
{
// DisplayCrossLarge(i1,j1,3,col) ;
}
else
{
a /= lg ;
b /= lg ;
vpImagePoint ip3;
ip3.set_i(ip2.get_i() - w*a);
ip3.set_j(ip2.get_j() - w*b);
vpImagePoint ip4;
ip4.set_i( ip3.get_i() - b*h );
ip4.set_j( ip3.get_j() + a*h );
if (lg > 2*vpImagePoint::distance(ip2, ip4) )
displayLine ( ip2, ip4, color, thickness ) ;
ip4.set_i( ip3.get_i() + b*h );
ip4.set_j( ip3.get_j() - a*h );
if (lg > 2*vpImagePoint::distance(ip2, ip4) )
displayLine ( ip2, ip4, color, thickness ) ;
displayLine ( ip1, ip2, color, thickness ) ;
}
}
catch (...)
{
vpERROR_TRACE("Error caught") ;
throw ;
}
}
else
{
vpERROR_TRACE("GTK not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"GTK not initialized")) ;
}
}
示例10: display
/*!
Display of the ellipse thanks to the equation parameters.
\param I : The image used as background.
\param center : Center of the ellipse
\param A : Semiminor axis of the ellipse.
\param B : Semimajor axis of the ellipse.
\param E : Angle made by the major axis and the i axis of the image frame \f$ (i,j) \f$
\param smallalpha : Smallest \f$ alpha \f$ angle in rad.
\param highalpha : Highest \f$ alpha \f$ angle in rad.
\param color : Color used to display th lines.
\param thickness : Thickness of the drawings.
*/
void vpMeEllipse::display(const vpImage<vpRGBa>& I, const vpImagePoint ¢er,
const double &A, const double &B, const double &E,
const double & smallalpha, const double &highalpha,
const vpColor &color, unsigned int thickness)
{
double j1, i1;
vpImagePoint iP11;
double j2, i2;
vpImagePoint iP22;
j1 = j2 = i1 = i2 = 0 ;
double incr = vpMath::rad(2) ; // angle increment
vpDisplay::displayCross(I,center,20, vpColor::red, thickness) ;
double k = smallalpha ;
while (k+incr<highalpha)
{
j1 = A *cos(k) ; // equation of an ellipse
i1 = B *sin(k) ; // equation of an ellipse
j2 = A *cos(k+incr) ; // equation of an ellipse
i2 = B *sin(k+incr) ; // equation of an ellipse
// (i1,j1) are the coordinates on the origin centered ellipse ;
// a rotation by "e" and a translation by (xci,jc) are done
// to get the coordinates of the point on the shifted ellipse
iP11.set_j ( center.get_j() + cos(E) *j1 - sin(E) *i1 );
iP11.set_i ( center.get_i() -( sin(E) *j1 + cos(E) *i1) );
// to get the coordinates of the point on the shifted ellipse
iP22.set_j ( center.get_j() + cos(E) *j2 - sin(E) *i2 );
iP22.set_i ( center.get_i() -( sin(E) *j2 + cos(E) *i2) );
vpDisplay::displayLine(I, iP11, iP22, color, thickness) ;
k += incr ;
}
j1 = A *cos(smallalpha) ; // equation of an ellipse
i1 = B *sin(smallalpha) ; // equation of an ellipse
j2 = A *cos(highalpha) ; // equation of an ellipse
i2 = B *sin(highalpha) ; // equation of an ellipse
// (i1,j1) are the coordinates on the origin centered ellipse ;
// a rotation by "e" and a translation by (xci,jc) are done
// to get the coordinates of the point on the shifted ellipse
iP11.set_j ( center.get_j() + cos(E) *j1 - sin(E) *i1 );
iP11.set_i ( center.get_i() -( sin(E) *j1 + cos(E) *i1) );
// to get the coordinates of the point on the shifted ellipse
iP22.set_j ( center.get_j() + cos(E) *j2 - sin(E) *i2 );
iP22.set_i ( center.get_i() -( sin(E) *j2 + cos(E) *i2) );
vpDisplay::displayLine(I, center, iP11, vpColor::red, thickness) ;
vpDisplay::displayLine(I, center, iP22, vpColor::blue, thickness) ;
}
示例11: waitForInit
/*!
Display a rectangle.
\param topLeft : Top-left corner of the rectangle.
\param bottomRight : Bottom-right corner of the rectangle.
\param color : Rectangle color.
\param fill : When set to true fill the rectangle.
\param thickness : Thickness of the four lines used to display the
rectangle.
\warning The thickness can not be set if the display uses the d3d library.
*/
void vpDisplayWin32::displayRectangle( const vpImagePoint &topLeft,
const vpImagePoint &bottomRight,
const vpColor &color, bool fill,
unsigned int thickness )
{
//wait if the window is not initialized
waitForInit();
unsigned int width = static_cast<unsigned int>( bottomRight.get_j() - topLeft.get_j() );
unsigned int height = static_cast<unsigned int>(bottomRight.get_i() - topLeft.get_i() );
window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
}
示例12: vpCDEBUG
/*!
Initialization of the tracking. The line is defined thanks to the
coordinates of two points.
\param I : Image in which the line appears.
\param ip1 : Coordinates of the first point.
\param ip2 : Coordinates of the second point.
*/
void
vpMeLine::initTracking(const vpImage<unsigned char> &I,
const vpImagePoint &ip1,
const vpImagePoint &ip2)
{
vpCDEBUG(1) <<" begin vpMeLine::initTracking()"<<std::endl ;
int i1s, j1s, i2s, j2s;
i1s = vpMath::round( ip1.get_i() );
i2s = vpMath::round( ip2.get_i() );
j1s = vpMath::round( ip1.get_j() );
j2s = vpMath::round( ip2.get_j() );
try{
// 1. On fait ce qui concerne les droites (peut etre vide)
{
// Points extremites
PExt[0].ifloat = (float)ip1.get_i() ;
PExt[0].jfloat = (float)ip1.get_j() ;
PExt[1].ifloat = (float)ip2.get_i() ;
PExt[1].jfloat = (float)ip2.get_j() ;
double angle_ = atan2((double)(i1s-i2s),(double)(j1s-j2s)) ;
a = cos(angle_) ;
b = sin(angle_) ;
// Real values of a, b can have an other sign. So to get the good values
// of a and b in order to initialise then c, we call track(I) just below
computeDelta(delta,i1s,j1s,i2s,j2s) ;
delta_1 = delta;
// vpTRACE("a: %f b: %f c: %f -b/a: %f delta: %f", a, b, c, -(b/a), delta);
sample(I) ;
}
// 2. On appelle ce qui n'est pas specifique
{
vpMeTracker::initTracking(I) ;
}
// Call track(I) to give the good sign to a and b and to initialise c which can be used for the display
track(I);
}
catch(...)
{
vpERROR_TRACE("Error caught") ;
throw ;
}
vpCDEBUG(1) <<" end vpMeLine::initTracking()"<<std::endl ;
}
示例13: return
/*!
\relates vpImagePoint
Returns true if ip1 and ip2 are different; otherwire returns true.
*/
VISP_EXPORT bool operator!=( const vpImagePoint &ip1, const vpImagePoint &ip2 ) {
//return ( ( ip1.get_i() != ip2.get_i() ) || ( ip1.get_j() != ip2.get_j() ) );
double i1 = ip1.get_i();
double j1 = ip1.get_j();
double i2 = ip2.get_i();
double j2 = ip2.get_j();
return (
( std::fabs(i1-i2) > std::fabs(vpMath::maximum(i1, i2))*std::numeric_limits<double>::epsilon() )
||
( std::fabs(j1-j2) > std::fabs(vpMath::maximum(j1, j2))*std::numeric_limits<double>::epsilon() )
);
}
示例14: vpException
/*!
Test if two segments are intersecting.
\throw vpException::divideByZeroError if the two lines are aligned (
denominator equal to zero).
\param ip1 : The first image point of the first segment.
\param ip2 : The second image point of the first segment.
\param ip3 : The first image point of the second segment.
\param ip4 : The second image point of the second segment.
*/
bool
vpPolygon::testIntersectionSegments(const vpImagePoint& ip1, const vpImagePoint& ip2, const vpImagePoint& ip3, const vpImagePoint& ip4)
{
double di1 = ip2.get_i() - ip1.get_i();
double dj1 = ip2.get_j() - ip1.get_j();
double di2 = ip4.get_i() - ip3.get_i();
double dj2 = ip4.get_j() - ip3.get_j();
double denominator = di1 * dj2 - dj1 * di2;
if(fabs(denominator) < std::numeric_limits<double>::epsilon()){
throw vpException(vpException::divideByZeroError, "Denominator is null, lines are parallels");
}
double alpha = - ( ( ip1.get_i() - ip3.get_i() ) * dj2 + di2 * ( ip3.get_j() - ip1.get_j())) / denominator;
if(alpha < 0 || alpha >= 1){
return false;
}
double beta = - (di1 * (ip3.get_j() - ip1.get_j() ) + dj1 * (ip1.get_i() - ip3.get_i()) ) / denominator;
if(beta < 0 || beta >= 1){
return false;
}
return true;
}
示例15: displayImageROI
/*!
Display a selection of the color image \e I in RGBa format (32bits).
\warning Display has to be initialized.
\warning Suppress the overlay drawing in the region of interest.
\param I : Image to display.
\param iP : Top left corner of the region of interest
\param w : Width of the region of interest
\param h : Height of the region of interest
\sa init(), closeDisplay()
*/
void vpDisplayGTK::displayImageROI ( const vpImage<vpRGBa> &I,const vpImagePoint &iP, const unsigned int w, const unsigned int h )
{
if (displayHasBeenInitialized)
{
vpImage<vpRGBa> Itemp;
vpImageTools::crop(I,(unsigned int)iP.get_i(), (unsigned int)iP.get_j(), h, w, Itemp);
/* Copie de l'image dans le pixmap fond */
gdk_draw_rgb_32_image(background,
gc, (gint)iP.get_u(), (gint)iP.get_v(), (gint)w, (gint)h,
GDK_RGB_DITHER_NONE,
(unsigned char *)Itemp.bitmap,
(gint)(4*w));
/* Permet de fermer la fenetre si besoin (cas des sequences d'images) */
//while (g_main_iteration(FALSE));
/* Le pixmap background devient le fond de la zone de dessin */
gdk_window_set_back_pixmap(widget->window, background, FALSE);
/* Affichage */
//gdk_window_clear(GTK_WINDOW(widget));
//flushDisplay() ;
}
else
{
vpERROR_TRACE("GTK not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"GTK not initialized")) ;
}
}