/*!
  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;
}
Example #2
0
/*!
  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;
}
Example #3
0
/*!
  Display a point at the image point \e ip location.
  \param ip : Point location.
  \param color : Point color.
*/
void vpDisplayWin32::displayPoint(const vpImagePoint &ip,
                                  const vpColor &color )
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->setPixel(ip, color);
}
TEST_F(WorkerThreadTest, StartAndStop)
{
    expectWorkerLifetimeReportingCalls();
    start();
    waitForInit();
    m_workerThread->terminateAndWait();
}
/*!
  \brief flush the Win32 buffer
  It's necessary to use this function to see the results of any drawing

*/
void vpDisplayWin32::flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height)
{
  //waits if the window is not initialized
  waitForInit();
  
  /*
  Under windows, flushing an ROI takes more time than
  flushing the whole image.
  Therefore, we update the maximum area even when asked to update a region.
  */
#ifdef FLUSH_ROI
  typedef struct _half_rect_t{
    unsigned short left_top;
    unsigned short right_bottom;
  } half_rect_t;

  half_rect_t hr1;
  half_rect_t hr2;

  hr1.left_top = (unsigned short)iP.get_u();
  hr1.right_bottom = (unsigned short)(iP.get_u()+width-1);

  hr2.left_top = (unsigned short)iP.get_v();
  hr2.right_bottom = (unsigned short)(iP.get_v()+height-1);

  //sends a message to the window
  WPARAM wp=*((WPARAM*)(&hr1));
  LPARAM lp=*((WPARAM*)(&hr2));
  PostMessage(window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
#else
  PostMessage(window.getHWnd(), vpWM_DISPLAY, 0,0);
#endif
}
Example #6
0
/*!
  Displays a string.
  \param ip : its top left point's coordinates
  \param text : The string to display
  \param color : The text's color
*/
void vpDisplayWin32::displayCharString(const vpImagePoint &ip,
                                     const char *text, 
				     const vpColor &color )
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawText(ip,text,color);
}
Example #7
0
/*!
  \brief flush the Win32 buffer
  It's necessary to use this function to see the results of any drawing

*/
void vpDisplayWin32::flushDisplay()
{
  //waits if the window is not initialized
  waitForInit();

  //sends a message to the window
  PostMessage(window.getHWnd(), vpWM_DISPLAY, 0,0);
}
Example #8
0
/*!
  Display a dashed line from image point \e ip1 to image point \e ip2.

  \warning This line is a dashed line only if the thickness is equal to 1.

  \param ip1,ip2 : Initial and final image points.
  \param color : Line color.
  \param thickness : Line thickness.
*/
void vpDisplayWin32::displayDotLine(const vpImagePoint &ip1, 
				    const vpImagePoint &ip2,
                                    const vpColor &color, 
				    unsigned int thickness )
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawLine(ip1,ip2,color,thickness,PS_DASHDOT);
}
Example #9
0
/*!
  Display a cross at the image point \e ip location.
  \param ip : Cross location.
  \param size : Size (width and height) of the cross.
  \param color : Cross color.
  \param thickness : Thickness of the lines used to display the cross.
*/
void vpDisplayWin32::displayCross( const vpImagePoint &ip, 
                                   unsigned int size, 
				   const vpColor &color,
				   unsigned int thickness)
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawCross(ip, size, color, thickness);
}
Example #10
0
/*!  
  Display a rectangle with \e topLeft as the top-left corner and \e
  width and \e height the rectangle size.

  \param topLeft : Top-left corner of the rectangle.
  \param width,height : Rectangle size.
  \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,
                                       unsigned int width, unsigned int height,
                                       const vpColor &color, bool fill,
			               unsigned int thickness )
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
}
Example #11
0
/*!
  Changes the window's position.

  \param winx, winy : Position of the upper-left window's border in the screen.

*/
void vpDisplayWin32::setWindowPosition(int winx, int winy)
{
  //wait if the window is not initialized
  waitForInit();

  //cahange the window position only
  SetWindowPos(window.hWnd,HWND_TOP, winx, winy, 0, 0,
	       SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);

}
Example #12
0
/*!
  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 vpDisplayWin32::displayImageROI ( const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int width, const unsigned int height )
{
  //waits if the window is not initialized
  waitForInit();

  //sets the image to render
  window.renderer->setImgROI(I,iP,width,height);
  //sends a message to the window
  //PostMessage(window.getHWnd(),vpWM_DISPLAY,0,0);
}
Example #13
0
/*!
  Display the gray level image \e I (8bits).

  \warning Display has to be initialized.

  \warning suppres the overlay drawing

  \param I : Image to display.

  \sa init(), closeDisplay()
*/
void vpDisplayWin32::displayImage(const vpImage<unsigned char> &I)
{
  //wait if the window is not initialized
  waitForInit();

  //sets the image to render
  window.renderer->setImg(I);
  //sends a message to the window
  //PostMessage(window.getHWnd(), vpWM_DISPLAY, 0,0);
}
Example #14
0
/*!
  Display a circle.
  \param center : Circle center position.
  \param radius : Circle radius.
  \param color : Circle color.
  \param fill : When set to true fill the circle.
  \param thickness : Thickness of the circle. This parameter is only useful 
  when \e fill is set to false.
*/
void vpDisplayWin32::displayCircle(const vpImagePoint &center,
                                   unsigned int radius,
                                   const vpColor &color,
                                   bool fill,
                                   unsigned int thickness )
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawCircle(center,radius,color,fill,thickness);
}
Example #15
0
/*!  
  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);
}
Example #16
0
/*!
  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 vpDisplayWin32::displayArrow(const vpImagePoint &ip1, 
		    const vpImagePoint &ip2,
		    const vpColor &color,
		    unsigned int w,unsigned int h,
		    unsigned int thickness)

{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
}
Example #17
0
/*!
  Display a rectangle.

  \param rectangle : Rectangle characteristics.
  \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 vpRect &rectangle,
                                       const vpColor &color, bool fill,
			                                 unsigned int thickness )
{
  //wait if the window is not initialized
  waitForInit();
  vpImagePoint topLeft;
  topLeft.set_i(rectangle.getTop());
  topLeft.set_j(rectangle.getLeft());
  window.renderer->drawRect(topLeft,
                            static_cast<unsigned int>( rectangle.getWidth() ),
                            static_cast<unsigned int>( rectangle.getHeight() ),
			                      color, fill, thickness);
}
Example #18
0
/*!
  Closes the display.
  Destroys the window.
*/
void vpDisplayWin32::closeDisplay()
{
  if (displayHasBeenInitialized) {
    waitForInit();
    PostMessage(window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
    //if the destructor is called for a reason different than a
    //problem in the thread creation
    if (iStatus) {
      //waits for the thread to end
      WaitForSingleObject(hThread, INFINITE);
      CloseHandle(hThread);
    }
    displayHasBeenInitialized = false ;
	window.initialized = false ;
  }
}
Example #19
0
/*!
  Get a keyboard event.

  \param blocking [in] : Blocking behavior.
  - When set to true, this method waits until a key is
    pressed and then returns always true.
  - When set to false, returns true only if a key is
    pressed, otherwise returns false.

  \return 
  - true if a key was pressed. This is always the case if blocking is set 
    to \e true.
  - false if no key was pressed. This can occur if blocking is set
    to \e false.
*/
bool vpDisplayWin32::getKeyboardEvent( bool blocking )
{
  //wait if the window is not initialized
  waitForInit();

  bool ret = false ;
  //waits for a keyboard event
  if(blocking){
    WaitForSingleObject(window.semaKey, 0); // key down
    WaitForSingleObject(window.semaKey, 0); // key up
    WaitForSingleObject(window.semaKey, INFINITE);
    ret = true;  
  }  
  else
    ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaKey, 0));
  
  return ret;
}
Example #20
0
/*!
  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;
}
/*!
  Wait for a click from one of the mouse button.

  \param blocking [in] : Blocking behavior.
  - 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 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( bool blocking)
{
  //wait if the window is not initialized
  waitForInit();
  bool ret = false;
  //sends a message to the window
//   PostMessage(window.getHWnd(), vpWM_GETCLICK, 0,0);

  //waits for a button to be pressed
  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));
  
  return ret; 
}
/*!

  Get a keyboard event.

  \param blocking [in] : Blocking behavior.
  - When set to true, this method waits until a key is
    pressed and then returns always true.
  - When set to false, returns true only if a key is
    pressed, otherwise returns false.

  \param string [out]: If possible, an ISO Latin-1 character
  corresponding to the keyboard key.

  \return 
  - true if a key was pressed. This is always the case if blocking is set 
    to \e true.
  - false if no key was pressed. This can occur if blocking is set
    to \e false.
*/
bool vpDisplayWin32::getKeyboardEvent(char *string, bool blocking)
{
  //wait if the window is not initialized
  waitForInit();

  bool ret = false ;
  //waits for a keyboard event
  if(blocking){
    WaitForSingleObject(window.semaKey, NULL); // key down
    WaitForSingleObject(window.semaKey, NULL); // key up
    WaitForSingleObject(window.semaKey, INFINITE);
    ret = true;  
  }  
  else {
     ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaKey, NULL));
  }
  //  printf("key: %ud\n", window.key);
  sprintf(string, "%s", window.lpString);
  
  return ret;
}
Example #23
0
/*!
  \brief flush the Win32 buffer
  It's necessary to use this function to see the results of any drawing

*/
void vpDisplayWin32::flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height)
{
  //waits if the window is not initialized
  waitForInit();
  /*
  Under windows, flushing an ROI takes more time than
  flushing the whole image.
  Therefore, we update the maximum area even when asked to update a region.
  */
  WORD left  = (WORD)iP.get_u();
  WORD right = (WORD)(iP.get_u()+width-1);

  WORD top    = (WORD)iP.get_v();
  WORD bottom = (WORD)(iP.get_v()+height-1);

  //sends a message to the window
  WPARAM wp = MAKEWPARAM(left, right);
  LPARAM lp = MAKELPARAM(top, bottom);

  PostMessage(window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
}
Example #24
0
/*!

  Get a keyboard event.

  \param blocking [in] : Blocking behavior.
  - When set to true, this method waits until a key is
    pressed and then returns always true.
  - When set to false, returns true only if a key is
    pressed, otherwise returns false.

  \param key [out]: If possible, an ISO Latin-1 character
  corresponding to the keyboard key.

  \return 
  - true if a key was pressed. This is always the case if blocking is set 
    to \e true.
  - false if no key was pressed. This can occur if blocking is set
    to \e false.
*/
bool vpDisplayWin32::getKeyboardEvent(std::string &key, bool blocking)
{
  //wait if the window is not initialized
  waitForInit();

  bool ret = false ;
  //waits for a keyboard event
  if(blocking){
    WaitForSingleObject(window.semaKey, 0); // key down
    WaitForSingleObject(window.semaKey, 0); // key up
    WaitForSingleObject(window.semaKey, INFINITE);
    ret = true;  
  }  
  else {
     ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaKey, 0));
  }
  //  printf("key: %ud\n", window.key);
  std::stringstream ss;
  ss << window.lpString;
  key = ss.str();
  
  return ret;
}
Example #25
0
/*!
  Get the coordinates of the mouse pointer.
  
  \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 
vpDisplayWin32::getPointerMotionEvent (vpImagePoint &ip)
{
  //wait if the window is not initialized
  waitForInit();

  bool ret = false;

  ret = (WAIT_OBJECT_0 == WaitForSingleObject(window.semaMove, 0));
  if (ret)
  {
    double u, v;
	std::cout << "toto";
    //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;
}
Example #26
0
void initProgram()
{
	//------------------------
	// start initializing crap
	//------------------------
	defaultExceptionHandler(); // set up the exception handler

    powerON(POWER_ALL_2D); // turn on everything

	#ifndef DEBUG_MODE
	fb_init(); // initialize top screen video
	#else
	debugInit();
	#endif
	bg_init(); // initialize bottom screen video

	setNewOrientation(ORIENTATION_0);

	// set up extra vram banks to be scratch memory
	vramSetBankE(VRAM_E_LCD);
	vramSetBankF(VRAM_F_LCD);
	vramSetBankG(VRAM_G_LCD);
	vramSetBankH(VRAM_H_LCD);
	vramSetBankI(VRAM_I_LCD);

	fb_setBGColor(30653);
	bg_setBGColor(0);
	drawStartSplash();

	lcdMainOnTop(); // set fb to top screen
	fb_swapBuffers();
	bg_swapBuffers();

	// out of order for competition
	irqInit(); // initialize irqs

    irqSet(IRQ_VBLANK, startvBlank);
	irqEnable(IRQ_VBLANK);

	setMode(INITFAT);
	setSoundInterrupt(); // initialize fifo irq

	setGenericSound(11025, 127, 64, 1);
	waitForInit(); // wait until arm7 has loaded and gone to sleep
	initComplexSound(); // initialize sound variables
	initWifi();
	fixGautami();

	setCursorProperties(0, 2, 0, 0);
	initCapture();
	initClipboard();

	// set defaults to english in case we can't load the langauge file for
	// some reason also takes care of partial translations.
	initLanguage();
	initRandomList();
	fixAndTags();

	resetKeyboard();
	setDate();

	if(!DRAGON_InitFiles())
	{
		// oops, no cf card!
		setMode(DISPLAYCOW);

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0,l_nofat);
		bg_swapBuffers();

		while(1)
		{
			// wee, la la la!
		  // More or less, we aren't going to do nothing here
		}
	}

	//--------------------------------------------------------------------
	//finished init, now check to make sure the DSOrganize dir is there...
	//--------------------------------------------------------------------

	findDataDirectory();
	makeDirectories();

	if(DRAGON_FileExists("DSOrganize") != FE_DIR)
	{
		setMode(DISPLAYCOW);

		// oops, not there, we must create!
		DRAGON_mkdir("DSOrganize");
		DRAGON_chdir("DSOrganize");
		DRAGON_mkdir("DAY");
		DRAGON_mkdir("HELP");
		DRAGON_mkdir("LANG");
		DRAGON_mkdir("RESOURCES");
		DRAGON_mkdir("REMINDER");
		DRAGON_mkdir("SCRIBBLE");
		DRAGON_mkdir("TODO");
		DRAGON_mkdir("VCARD");
		DRAGON_mkdir("ICONS");
		DRAGON_mkdir("CACHE");
		DRAGON_mkdir("COOKIES");
		DRAGON_mkdir("HOME");
		DRAGON_chdir("/");

		makeDefaultSettings();

		setFont(font_arial_11);
		setColor(0xFFFF);

		bg_dispSprite(96, 5, errmsg, 0);
		bg_setClipping(5,25,250,181);
		bg_dispString(0,0, l_createdir);
		bg_swapBuffers();

		while(!keysDown())
		{
			scanKeys();
		}
	}

	setMode(INITPLUGIN);

	//-------------------------------------------------------------------
	//finished creating dirs, now check to make sure if they extracted it
	//did their extracting program actually get all the dirs?
	//-------------------------------------------------------------------

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("Day") != FE_DIR)
	{
		DRAGON_mkdir("DAY");
	}
	if(DRAGON_FileExists("Help") != FE_DIR)
	{
		DRAGON_mkdir("HELP");
	}
	if(DRAGON_FileExists("Lang") != FE_DIR)
	{
		DRAGON_mkdir("LANG");
	}
	if(DRAGON_FileExists("Reminder") != FE_DIR)
	{
		DRAGON_mkdir("REMINDER");
	}
	if(DRAGON_FileExists("Scribble") != FE_DIR)
	{
		DRAGON_mkdir("SCRIBBLE");
	}
	if(DRAGON_FileExists("Todo") != FE_DIR)
	{
		DRAGON_mkdir("TODO");
	}
	if(DRAGON_FileExists("VCard") != FE_DIR)
	{
		DRAGON_mkdir("VCARD");
	}
	if(DRAGON_FileExists("Icons") != FE_DIR)
	{
		DRAGON_mkdir("ICONS");
	}
	if(DRAGON_FileExists("Cache") != FE_DIR)
	{
		DRAGON_mkdir("CACHE");
	}
	if(DRAGON_FileExists("Cookies") != FE_DIR)
	{
		DRAGON_mkdir("COOKIES");
	}
	if(DRAGON_FileExists("Home") != FE_DIR)
	{
		DRAGON_mkdir("HOME");
	}

	DRAGON_chdir("/");

	//-------------------------------------------
	//how about we load the settings for them eh?
	//-------------------------------------------
	loadSettings();

	DRAGON_chdir(d_base);

	if(DRAGON_FileExists("startup.wav") == FE_FILE)
	{
		char tStr[256];

		sprintf(tStr, "%sstartup.wav", d_base);
		loadWavToMemory();
		loadSound(tStr);
	}

	DRAGON_chdir("/");
	initStartScreen();

    irqSet(IRQ_VBLANK, vBlank);
	fb_setBGColor(genericFillColor);
	bg_setBGColor(genericFillColor);
}
DotTracker::DotTracker(unsigned queueSize)
    : queueSize_(queueSize),
      nodeHandle_(),
      imageTransport_(nodeHandle_),
      image_(),
      rectifiedImageTopic_(),
      cameraInfoTopic_(),
      pointCorrespondenceTopic_(),
      model_prefix_(),
      cameraSubscriber_(),
      pointCorrespondenceSubscriber_(),
      pointMsg_(),
	  points_(),
	  trackers_(),
	  trackers_status_(),
	  homography_(),
	  homography_pub_()
      
{
	
	homography_ = cvCreateMat(3, 3, CV_64FC1);
	homography_pub_ =  nodeHandle_.advertise<std_msgs::Float64MultiArray>("homography", 10);
	
	// find camera prefix name
	ros::Rate rate (1);
    while (rectifiedImageTopic_.empty ())
      {
	ros::param::get ("DotTracker/camera_topic", rectifiedImageTopic_);
	ros::param::get ("DotTracker/camera_info_topic", cameraInfoTopic_);
	ros::param::get ("DotTracker/point_correspondence_topic", pointCorrespondenceTopic_);
	ros::param::get ("DotTracker/model_prefix", model_prefix_);
	if (!ros::param::has ("DotTracker/camera_topic"))
	  {
	    ROS_WARN
	      ("the camera_prefix parameter does not exist.\n"
	       "This may mean that:\n"
	       "- the tracker is not launched,\n"
	       "- the tracker and viewer are not running in the same namespace."
	       );
	  }
	else if (rectifiedImageTopic_.empty ())
	  {
	    ROS_INFO
	      ("tracker is not yet initialized, waiting...\n"
	       "You may want to launch the client to initialize the tracker.");
	  }
	if (!ros::ok ())
	  return;
	rate.sleep ();
      }
	      
	ROS_INFO_STREAM("camera_topic is " << rectifiedImageTopic_);
	ROS_INFO_STREAM("camera_info_topic is " << cameraInfoTopic_);
	ROS_INFO_STREAM("point_correspondence_topic is " << pointCorrespondenceTopic_);
	
	
	cameraSubscriber_ = imageTransport_.subscribeCamera
      (rectifiedImageTopic_, queueSize_,
       bindImageCallback(image_, header_, info_));
    //cameraSubscriber_ = imageTransport_.subscribe(rectifiedImageTopic_, queueSize_, imageCallback);
    // Wait for the image to be initialized.
     
    //register callback for pointCorrespondance 
    pointCorrespondenceSubscriber_ = nodeHandle_.subscribe(pointCorrespondenceTopic_, 1, &DotTracker::pointCorrespondenceCallback, this);
    //nodeHandle_.subscribe(pointCorrespondenceTopic_, 1, pointCorrespondenceCallbackGlobal);
    
     
    waitForImage();
    
    waitForInit();
}
Example #28
0
/*!
  Gets the displayed image (if overlay, if any).
  \param I : Image to fill.
*/
void vpDisplayWin32::getImage(vpImage<vpRGBa> &I)
{
  //wait if the window is not initialized
  waitForInit();
  window.renderer->getImage(I);
}
Example #29
0
/*!
  Clears the display.
  \param color : the color to fill the display with
*/
void vpDisplayWin32::clearDisplay(const vpColor &color){
  //wait if the window is not initialized
  waitForInit();
  window.renderer->clear(color);
}
Example #30
0
/*!
  Changes the window's titlebar text

  \param windowtitle : Window title.
*/
void vpDisplayWin32::setTitle(const std::string &windowtitle)
{
  //wait if the window is not initialized
  waitForInit();
  SetWindowText(window.hWnd, windowtitle.c_str());
}