Using cameras and blobfinders
From The Player Project
(→PlayerC++ client program) |
|||
| (4 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | |||
| + | == 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 [http://playerstage.sourceforge.net/doc/Player-svn/player/group__drivers.html 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: | ||
<pre> | <pre> | ||
| + | $ player cameraconfig.cfg | ||
| + | </pre> | ||
| + | |||
| + | And in a second terminal window, run the playercam utility. | ||
| + | <pre> | ||
| + | $ playercam | ||
| + | </pre> | ||
| + | |||
| + | 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. | ||
| + | <pre> | ||
| + | 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. | ||
| + | </pre> | ||
| + | |||
| + | == PlayerC++ client program == | ||
| + | |||
| + | The following program is available in the Player source tree, at examples/libplayerc++/camera.cc. 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 [http://playerstage.sourceforge.net/doc/Player-svn/player/classPlayerCc_1_1CameraProxy.html CameraProxy documentation]. | ||
| + | |||
| + | <source lang=cpp> | ||
#include <libplayerc++/playerc++.h> | #include <libplayerc++/playerc++.h> | ||
#include "args.h" | #include "args.h" | ||
| Line 33: | Line 66: | ||
return 1; | return 1; | ||
} | } | ||
| - | </ | + | </source> |
| - | + | ||
| - | + | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
| + | [[Category:Tutorials]] | ||
Latest revision as of 03:31, 23 May 2011
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++/camera.cc. 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); try { PlayerCc::PlayerClient client(gHostname, gPort); PlayerCc::CameraProxy cp(&client, gIndex); for (uint i=0; i<10; ++i) { client.Read(); cp.SaveFrame("camera"); std::cout << cp << std::endl; } } catch (PlayerCc::PlayerError e) { std::cerr << e << std::endl; return -1; } return 1; }