本文整理汇总了C++中vpImagePoint::set_v方法的典型用法代码示例。如果您正苦于以下问题:C++ vpImagePoint::set_v方法的具体用法?C++ vpImagePoint::set_v怎么用?C++ vpImagePoint::set_v使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vpImagePoint
的用法示例。
在下文中一共展示了vpImagePoint::set_v方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/*!
Wait for a mouse button click and get the position of the clicked
pixel. The button used to click is also set.
\param ip [out] : The coordinates of the clicked image point.
\param button [out] : The button used to click.
\param blocking [in] :
- When set to true, this method waits until a mouse button is
pressed and then returns always true.
- When set to false, returns true only if a mouse button is
pressed, otherwise returns false.
\return true if a mouse button is pressed, false otherwise. If a
button is pressed, the location of the mouse pointer is updated in
\e ip.
*/
bool
vpDisplayOpenCV::getClick(vpImagePoint &ip,
vpMouseButton::vpMouseButtonType& button,
bool blocking)
{
bool ret = false;
if (displayHasBeenInitialized) {
//flushDisplay() ;
double u, v;
if (blocking){
lbuttondown = false;
mbuttondown = false;
rbuttondown = false;
}
do {
if (lbuttondown){
ret = true ;
u = (unsigned int)x_lbuttondown;
v = (unsigned int)y_lbuttondown;
ip.set_u( u );
ip.set_v( v );
button = vpMouseButton::button1;
lbuttondown = false;
}
if (mbuttondown){
ret = true ;
u = (unsigned int)x_mbuttondown;
v = (unsigned int)y_mbuttondown;
ip.set_u( u );
ip.set_v( v );
button = vpMouseButton::button2;
mbuttondown = false;
}
if (rbuttondown){
ret = true ;
u = (unsigned int)x_rbuttondown;
v = (unsigned int)y_rbuttondown;
ip.set_u( u );
ip.set_v( v );
button = vpMouseButton::button3;
rbuttondown = false;
}
if (blocking) cvWaitKey(10);
} while ( ret == false && blocking == true);
}
else {
vpERROR_TRACE("OpenCV not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"OpenCV not initialized")) ;
}
return ret;
}
示例2: while
/*!
Wait for a click from one of the mouse button and get the position
of the clicked image point.
\param ip [out] : The coordinates of the clicked image point.
\param blocking [in] : true for a blocking behaviour waiting a mouse
button click, false for a non blocking behaviour.
\return
- true if a button was clicked. This is always the case if blocking is set
to \e true.
- false if no button was clicked. This can occur if blocking is set
to \e false.
*/
bool
vpDisplayGTK::getClick(vpImagePoint &ip, bool blocking)
{
bool ret = false;
if (displayHasBeenInitialized) {
double u, v ;
do {
GdkEvent *ev = NULL;
while ((ev = gdk_event_get())!=NULL){
if (ev->any.window == widget->window && ev->type == GDK_BUTTON_PRESS) {
u = ((GdkEventButton *)ev)->x ;
v = ((GdkEventButton *)ev)->y ;
ip.set_u( u );
ip.set_v( v );
ret = true ;
}
gdk_event_free(ev) ;
}
if (blocking){
flushDisplay();
vpTime::wait(100);
}
} while ( ret == false && blocking == true);
}
else {
vpERROR_TRACE("GTK not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"GTK not initialized")) ;
}
return ret ;
}
示例3: getClick
/*!
Wait for a mouse button click release and get the position of the
image point were the click release occurs. The button used to click is
also set. Same method as getClick(unsigned int&, unsigned int&,
vpMouseButton::vpMouseButtonType &, bool).
\param ip [out] : Position of the clicked image point.
\param button [in] : Button used to click.
\param blocking [in] : true for a blocking behaviour waiting a mouse
button click, false for a non blocking behaviour.
\return
- true if a button was clicked. This is always the case if blocking is set
to \e true.
- false if no button was clicked. This can occur if blocking is set
to \e false.
\sa getClick(vpImagePoint &, vpMouseButton::vpMouseButtonType &, bool)
*/
bool vpDisplayWin32::getClickUp(vpImagePoint &ip,
vpMouseButton::vpMouseButtonType& button,
bool blocking)
{
//wait if the window is not initialized
waitForInit();
bool ret = false;
double u, v;
//tells the window there has been a getclickup demand
// PostMessage(window.getHWnd(), vpWM_GETCLICKUP, 0,0);
//waits for a click release
if(blocking){
WaitForSingleObject(window.semaClickUp, 0);
WaitForSingleObject(window.semaClick, 0);//to erase previous events
WaitForSingleObject(window.semaClickUp, INFINITE);
ret = true;
}
else
ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaClickUp, 0));
u = window.clickXUp;
v = window.clickYUp;
ip.set_u( u );
ip.set_v( v );
button = window.clickButtonUp;
return ret;
}
示例4: throw
/*!
Get the coordinates of the mouse pointer.
\warning Not implemented yet.
\param ip [out] : The coordinates of the mouse pointer.
\return true if a pointer motion event was received, false otherwise.
\exception vpDisplayException::notInitializedError : If the display
was not initialized.
*/
bool
vpDisplayOpenCV::getPointerMotionEvent (vpImagePoint &ip )
{
bool ret = false;
if (displayHasBeenInitialized) {
//flushDisplay() ;
double u, v;
if (move){
ret = true ;
u = (unsigned int)x_move;
v = (unsigned int)y_move;
ip.set_u( u );
ip.set_v( v );
move = false;
}
}
else {
vpERROR_TRACE("OpenCV not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"OpenCV not initialized")) ;
}
return ret;
}
示例5: waitForInit
/*!
Wait for a click from one of the mouse button and get the position
of the clicked image point.
\param ip [out] : The coordinates of the clicked image point.
\param blocking [in] : true for a blocking behaviour waiting a mouse
button click, false for a non blocking behaviour.
\return
- true if a button was clicked. This is always the case if blocking is set
to \e true.
- false if no button was clicked. This can occur if blocking is set
to \e false.
*/
bool vpDisplayWin32::getClick(vpImagePoint &ip, bool blocking)
{
//wait if the window is not initialized
waitForInit();
bool ret = false ;
double u, v;
//tells the window there has been a getclick demand
// PostMessage(window.getHWnd(), vpWM_GETCLICK, 0,0);
//waits for a click
if(blocking){
WaitForSingleObject(window.semaClick, NULL);
WaitForSingleObject(window.semaClickUp, NULL);//to erase previous events
WaitForSingleObject(window.semaClick, INFINITE);
ret = true;
}
else
ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaClick, NULL));
u = window.clickX;
v = window.clickY;
ip.set_u( u );
ip.set_v( v );
return ret;
}
示例6: getClick
/*!
Wait for a mouse button click release and get the position of the
image point were the click release occurs. The button used to click is
also set. Same method as getClick(unsigned int&, unsigned int&,
vpMouseButton::vpMouseButtonType &, bool).
\param ip [out] : Position of the clicked image point.
\param button [in] : Button used to click.
\param blocking [in] : true for a blocking behaviour waiting a mouse
button click, false for a non blocking behaviour.
\return
- true if a button was clicked. This is always the case if blocking is set
to \e true.
- false if no button was clicked. This can occur if blocking is set
to \e false.
\sa getClick(vpImagePoint &, vpMouseButton::vpMouseButtonType &, bool)
*/
bool
vpDisplayGTK::getClickUp(vpImagePoint &ip,
vpMouseButton::vpMouseButtonType& button,
bool blocking)
{
bool ret = false;
if ( displayHasBeenInitialized ) {
//flushDisplay() ;
double u, v ;
do {
GdkEvent *ev = NULL;
while ((ev = gdk_event_get())!=NULL){
if ( ev->any.window == widget->window
&& ev->type == GDK_BUTTON_RELEASE) {
u = ((GdkEventButton *)ev)->x ;
v = ((GdkEventButton *)ev)->y ;
ip.set_u( u );
ip.set_v( v );
switch ( ( int ) ( ( GdkEventButton * ) ev )->button ) {
case 1:
button = vpMouseButton::button1; break;
case 2:
button = vpMouseButton::button2; break;
case 3:
button = vpMouseButton::button3; break;
}
ret = true ;
}
gdk_event_free(ev) ;
}
if (blocking){
flushDisplay();
vpTime::wait(100);
}
} while ( ret == false && blocking == true);
}
else {
vpERROR_TRACE ( "GTK not initialized " ) ;
throw ( vpDisplayException ( vpDisplayException::notInitializedError,
"GTK not initialized" ) ) ;
}
return ret;
}
示例7: waitForInit
/*!
Get the coordinates of the mouse pointer.
\param ip [out] : The coordinates of the mouse pointer.
\return true.
\exception vpDisplayException::notInitializedError : If the display
was not initialized.
*/
bool
vpDisplayWin32::getPointerPosition (vpImagePoint &ip)
{
//wait if the window is not initialized
waitForInit();
bool ret = true ;
double u, v;
//tells the window there has been a getclick demand
//PostMessage(window.getHWnd(), vpWM_GETPOINTERMOTIONEVENT, 0,0);
u = window.coordX;
v = window.coordY;
ip.set_u( u );
ip.set_v( v );
return ret;
}
示例8: getPointerMotionEvent
/*!
Get the coordinates of the mouse pointer.
\param ip [out] : The coordinates of the mouse pointer.
\return true.
\exception vpDisplayException::notInitializedError : If the display
was not initialized.
*/
bool
vpDisplayOpenCV::getPointerPosition ( vpImagePoint &ip)
{
if (displayHasBeenInitialized) {
//vpTRACE("Not implemented yet");
bool moved = getPointerMotionEvent(ip);
if (!moved)
{
double u, v;
u = (unsigned int)x_move;
v = (unsigned int)y_move;
ip.set_u( u );
ip.set_v( v );
}
return false;
}
else {
vpERROR_TRACE("OpenCV not initialized " ) ;
throw(vpDisplayException(vpDisplayException::notInitializedError,
"OpenCV not initialized")) ;
}
//return false; // Never reached after throw()
}