gphoto2pp is a C++11 wrapper for libgphoto2.
- Prerequisites
- 2 Minute Tutorial
- Installation
- Examples
- Dev/Test/Contributor
- FAQ
- Doxygen Documentation
- Other Useful Links
- Version History
- A C++11 compiler (I've only tested g++, but others should work)
- libgphoto2 (2.4.14 or greater)
- cmake (2.8.3 or greater), only needed to build the library once to generate libgphoto2pp.so
The following snip will show you a quick demo of how easy it is to interact with your camera using gphoto2pp. Don't forget you will need to follow the installation instructions before you can compile this 2 minute tutorial on your computer.
Make a source file eg. touch testgphoto2pp.cpp
Now put this in the source file
#include <gphoto2pp/camera_wrapper.hpp> // Header for CameraWrapper
#include <gphoto2pp/camera_file_wrapper.hpp> // Header for CameraFileWrapper
#include <gphoto2pp/helper_camera_wrapper.hpp> // Used for helper::capture(...) method
#include <iostream>
int main()
{
// Connects to the first camera found and initializes
gphoto2pp::CameraWrapper camera;
// Prints out the summary of your camera's abilities
std::cout << camera.getSummary() << std::endl;
// Creates empty instance of a cameraFile, which will be populated in our helper method
gphoto2pp::CameraFileWrapper cameraFile;
// Takes a picture with the camera and does all of the behind the scenes fetching
gphoto2pp::helper::capture(camera, cameraFile);
// Lastly saves the picture to your hard drive
// Your camera might take files in different formats (bmp, raw)
// so this extension might be wrong and you should rename your file appropriately
cameraFile.save("my-gphoto2pp-test.jpg");
return 1;
}
Now compile with the command:
g++ -std=c++11 testgphoto2pp.cpp -lgphoto2 -lgphoto2pp
and then execute it
./a.out
That's it! The library is certainly capable of more, which you can view at examples.
Please see the Installation document for details.
Please see the Examples document for details about all examples provided.
If you would like to contribute/develop/test gphoto2pp, please see the Dev-Test doc.
Please see the FAQ document
Please see this projects github pages for the auto generated Doxygen Page.
If you are new to gphoto2pp (and perhaps gphoto), then please view some of these resources:
- This library wraps gphoto
Placeholder