Using cameras and blobfinders

From The Player Project

Revision as of 03:28, 31 January 2011 by Rmattes (Talk | contribs)
Jump to: navigation, search

Creating a Configuration File

The first step to using your camera and blobfinder is to identify which drivers support your devices, and create a configuration file. To find a driver that supports your camera, see the list of Available Drivers. Once you find a driver that supports your camera and/or blobfinder, you will need to create a configuration file. For more information on writing configuration files, see Writing configuration files.

Testing your camera

Player comes with a client program called "playercam" that subscribes to camera interfaces and displays the available image and blobfinder data. To use it, start Player in a terminal window with your configuration file:

$ player cameraconfig.cfg

And in a second terminal window, run the playercam utility.

$ playercam

Playercam accepts a number of different command line options to control which Player server and interfaces to connect to. Type "playercam -help" to see the usage.

 playercam - camera test utility for a player camera

USAGE:  playercam [options] 

Where [options] can be:
  -help          : print this message.
  -h <hostname>  : host that is running player
  -p <port>      : the port number of the host
  -i <index>     : the index of the camera
  -b <index>     : the index of the blobfinder
  -r <rate>      : the refresh rate of the video
  -t <transport> : transport to use (either "tcp" or "udp")

Currently supports RGB888 and 8/16-bit grey scale images.

PlayerC++ client program

The following program is available in the Player source tree, at examples/libplayerc++/ This program subscribes to a camera interface from a Player server using the PlayerC++ CameraProxy, and uses the CameraProxy to save images from the server to disk. For all available methods in the CameraProxy, see the CameraProxy documentation.

#include <libplayerc++/playerc++.h>
#include "args.h"
#include <iostream>

int main(int argc, char** argv)
  parse_args(argc, argv);

    PlayerCc::PlayerClient client(gHostname, gPort);
    PlayerCc::CameraProxy cp(&client, gIndex);

    for (uint i=0; i<10; ++i)
      std::cout << cp << std::endl;

  catch (PlayerCc::PlayerError e)
    std::cerr << e << std::endl;
    return -1;
  return 1;
Personal tools