gphoto2pp is a C++11 wrapper for libgphoto2.
- Prerequisites
- 2 Minute Tutorial
- Building and Installing
- Examples
- Dev/Test/Contributor
- FAQ
- Doxygen Documentation
- Other Useful Links
- A C++11 compiler
- libgphoto2 (2.5.0 or greater)
- cmake (3.1 or greater) (build)
- cxxtest (optional, for running tests)
- doxygen and graphviz (optional, for generating documentation)
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.
git clone 'https://github.com/Marius-Linux/gphoto2pp'
cd gphotopp
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
make examples //Optional, for building examples
make docs //Optional, for building documentation with doxygen
sudo make install
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