gphoto2pp is a C++11 wrapper for libgphoto2.
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:
Placeholder
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。